Package htsjdk.samtools
Class TextTagCodec
- java.lang.Object
-
- htsjdk.samtools.TextTagCodec
-
public class TextTagCodec extends Object
Converter between SAM text representation of a tag, and in-memory Object representation. Note that this class is not thread-safe, in that some local variables have been made into instance variables in order to reduce object creation, but it should not ever be the case that the same instance is used in multiple threads.
-
-
Constructor Summary
Constructors Constructor Description TextTagCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map.Entry<String,Object>
decode(String tag)
Convert typed tag in SAM text format (name:type:value) into tag name and Object value representation.String
encode(String tagName, Object value)
Convert in-memory representation of tag to SAM text representation.String
encodeUntypedTag(String tagName, Object value)
Encode a standard header tag, which should not have a type field.
-
-
-
Method Detail
-
encode
public String encode(String tagName, Object value)
Convert in-memory representation of tag to SAM text representation.- Parameters:
tagName
- Two-character tag name.value
- Tag value as approriate Object subclass.- Returns:
- SAM text String representation, i.e. name:type:value
-
encodeUntypedTag
public String encodeUntypedTag(String tagName, Object value)
Encode a standard header tag, which should not have a type field.- Parameters:
tagName
- 2-character String.value
- Not necessarily a String. Some of these are integers but the type is implied by the tagName. Converted to String with toString().- Returns:
- Colon-separated text representation suitable for a SAM header, i.e. name:value.
-
decode
public Map.Entry<String,Object> decode(String tag)
Convert typed tag in SAM text format (name:type:value) into tag name and Object value representation.- Parameters:
tag
- SAM text format name:type:value tag.- Returns:
- Tag name as 2-character String, and tag value in appropriate class based on tag type. If value is an unsigned array, then the value is a TagValueAndUnsignedArrayFlag object.
-
-