Package htsjdk.samtools.cram.encoding
Class CRAMEncoding<T>
java.lang.Object
htsjdk.samtools.cram.encoding.CRAMEncoding<T>
- Type Parameters:
T
- the (source) data eries value type for this encoding. There is no way to express the type constraint on this type using Java type bounds, since the legitimate values are drawn from a set of Java types that correspond to the allowable types defined byDataSeriesType
, but logically it must be a type that corresponds to one of theDataSeriesType
"types", i.e., it must one of be Byte, Integer, Long or byte[].
- Direct Known Subclasses:
BetaIntegerEncoding
,ByteArrayLenEncoding
,ByteArrayStopEncoding
,CanonicalHuffmanByteEncoding
,CanonicalHuffmanIntegerEncoding
,ExternalEncoding
,GammaIntegerEncoding
,GolombIntegerEncoding
,GolombLongEncoding
,GolombRiceIntegerEncoding
,SubexponentialIntegerEncoding
A base class for the various CRAM encodings. This class serves as a (typed) bridge between an
EncodingDescriptor
, which only describes an encoding, and the various CRAMCodec
classes,
which can be used to read and write typed values to a stream. Has methods to serialize/deserialize
its parameters to/from a byte array and a method to construct a read or write CRAMCodec
instance.-
Constructor Summary
ModifierConstructorDescriptionprotected
CRAMEncoding
(EncodingID encodingId) Create a new encoding. -
Method Summary
Modifier and TypeMethodDescriptionbuildCodec
(SliceBlocksReadStreams sliceBlocksReadStreams, SliceBlocksWriteStreams sliceBlocksWriteStreams) Instantiate the codec represented by this encoding by supplying it with the appropriate streamsbuildReadCodec
(SliceBlocksReadStreams sliceBlocksReadStreams) Convenience initializer method for read codecsbuildWriteCodec
(SliceBlocksWriteStreams sliceBlocksWriteStreams) Convenience initializer method for write codecsid()
abstract byte[]
Serialize encoding parameters to an ITF8-encoded byte array.
-
Constructor Details
-
CRAMEncoding
Create a new encoding. Concrete implementation constructors will specify their parameters- Parameters:
encodingId
- the EncodingID associated with the concrete implementation
-
-
Method Details
-
id
-
toEncodingDescriptor
-
toSerializedEncodingParams
public abstract byte[] toSerializedEncodingParams()Serialize encoding parameters to an ITF8-encoded byte array. By convention, each subclass should have a corresponding and symmetric "fromSerializedEncodingParams" that returns a new instance of that encoding populated with values from the serialized encoding params.- Returns:
- a byte array containing the encoding's parameter values encoded as an ITF8 stream.
-
buildCodec
public abstract CRAMCodec<T> buildCodec(SliceBlocksReadStreams sliceBlocksReadStreams, SliceBlocksWriteStreams sliceBlocksWriteStreams) Instantiate the codec represented by this encoding by supplying it with the appropriate streams -
buildReadCodec
Convenience initializer method for read codecs- Parameters:
sliceBlocksReadStreams
- the core block bit stream aCoreCodec
will read from- Returns:
-
buildWriteCodec
Convenience initializer method for write codecs- Parameters:
sliceBlocksWriteStreams
- the core block bit stream aCoreCodec
will write to- Returns:
-