Class TokenStreams
java.lang.Object
htsjdk.samtools.cram.compression.nametokenisation.TokenStreams
Token streams for the CRAM 3.1 name tokeniser. Stores decompressed byte streams indexed
by (position, tokenType). Accepts an optional shared
RANSNx16Decode instance to
avoid allocating a fresh 1MB+ decoder per stream.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final intstatic final byte -
Constructor Summary
ConstructorsConstructorDescriptionTokenStreams(ByteBuffer inputByteBuffer, int useArith, int numNames) The outer index corresponds to the (column) position in a name (starting at index 0).TokenStreams(ByteBuffer inputByteBuffer, int useArith, int numNames, RANSNx16Decode sharedRansDecoder) -
Method Summary
Modifier and TypeMethodDescriptiongetStream(int tokenPosition, int tokenType) Return the token stream for a specific position and token type.getStreamsForPos(int pos) Return the array of token streams for a given column position.
-
Field Details
-
TOKEN_TYPE
public static final byte TOKEN_TYPE- See Also:
-
TOKEN_STRING
public static final byte TOKEN_STRING- See Also:
-
TOKEN_CHAR
public static final byte TOKEN_CHAR- See Also:
-
TOKEN_DIGITS0
public static final byte TOKEN_DIGITS0- See Also:
-
TOKEN_DZLEN
public static final byte TOKEN_DZLEN- See Also:
-
TOKEN_DUP
public static final byte TOKEN_DUP- See Also:
-
TOKEN_DIFF
public static final byte TOKEN_DIFF- See Also:
-
TOKEN_DIGITS
public static final byte TOKEN_DIGITS- See Also:
-
TOKEN_DELTA
public static final byte TOKEN_DELTA- See Also:
-
TOKEN_DELTA0
public static final byte TOKEN_DELTA0- See Also:
-
TOKEN_MATCH
public static final byte TOKEN_MATCH- See Also:
-
TOKEN_NOP
public static final byte TOKEN_NOP- See Also:
-
TOKEN_END
public static final byte TOKEN_END- See Also:
-
TOTAL_TOKEN_TYPES
public static final int TOTAL_TOKEN_TYPES- See Also:
-
TYPE_TOKEN_FLAG_MASK
public static final byte TYPE_TOKEN_FLAG_MASK- See Also:
-
DUP_PREVIOUS_STREAM_FLAG_MASK
public static final byte DUP_PREVIOUS_STREAM_FLAG_MASK- See Also:
-
NEW_POSITION_FLAG_MASK
public static final byte NEW_POSITION_FLAG_MASK- See Also:
-
-
Constructor Details
-
TokenStreams
The outer index corresponds to the (column) position in a name (starting at index 0). The inner index corresponds to the token type. Each element in this list of lists is a ByteBuffer of tokens.- Parameters:
inputByteBuffer- - the input buffer of token streamsuseArith- - true to use range coding; false for rANS codingnumNames- - the number of read names in the slice for which this token stream is being created
-
TokenStreams
public TokenStreams(ByteBuffer inputByteBuffer, int useArith, int numNames, RANSNx16Decode sharedRansDecoder) - Parameters:
inputByteBuffer- the input buffer of token streamsuseArith- true to use range coding; false for rANS codingnumNames- the number of read names in the slicesharedRansDecoder- optional shared rANS decoder instance (avoids per-stream allocation)
-
-
Method Details
-
getStreamsForPos
Return the array of token streams for a given column position. The returned array is indexed by token type constant (e.g.,TOKEN_TYPE).- Parameters:
pos- the column position (0-based)- Returns:
- array of ByteBuffers indexed by token type; entries may be null
-
getStream
Return the token stream for a specific position and token type.- Parameters:
tokenPosition- the column position (0-based)tokenType- the token type constant (e.g.,TOKEN_STRING)- Returns:
- the ByteBuffer for that stream, or null if not present
-