Package htsjdk.samtools.cram.encoding
Class CRAMEncoding<T>
- java.lang.Object
-
- htsjdk.samtools.cram.encoding.CRAMEncoding<T>
-
- Type Parameters:
T
- data series type
- Direct Known Subclasses:
BetaIntegerEncoding
,ByteArrayLenEncoding
,ByteArrayStopEncoding
,CanonicalHuffmanByteEncoding
,CanonicalHuffmanIntegerEncoding
,ExternalByteArrayEncoding
,ExternalByteEncoding
,ExternalIntegerEncoding
,ExternalLongEncoding
,GammaIntegerEncoding
,GolombIntegerEncoding
,GolombLongEncoding
,GolombRiceIntegerEncoding
,SubexponentialIntegerEncoding
public abstract class CRAMEncoding<T> extends Object
An interface to describe how a data series is encoded. It also has methods to serialize/deserialize its parameters to/from a byte array and a method to construct aCRAMCodec
instance.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CRAMEncoding(EncodingID id)
Create a new encoding.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract CRAMCodec<T>
buildCodec(BitInputStream coreBlockInputStream, BitOutputStream coreBlockOutputStream, Map<Integer,ByteArrayInputStream> externalBlockInputMap, Map<Integer,ByteArrayOutputStream> externalBlockOutputMap)
Instantiate the codec represented by this encoding by supplying it with the appropriate streamsCRAMCodec<T>
buildReadCodec(BitInputStream coreBlockInputStream, Map<Integer,ByteArrayInputStream> externalBlockInputMap)
Convenience initializer method for read codecsCRAMCodec<T>
buildWriteCodec(BitOutputStream coreBlockOutputStream, Map<Integer,ByteArrayOutputStream> externalBlockOutputMap)
Convenience initializer method for write codecsEncodingID
id()
abstract byte[]
toByteArray()
Subclasses but have a defined serialization of their parametersEncodingParams
toParam()
-
-
-
Constructor Detail
-
CRAMEncoding
protected CRAMEncoding(EncodingID id)
Create a new encoding. Concrete implementation constructors will specify their parameters- Parameters:
id
- the EncodingID associated with the concrete implementation
-
-
Method Detail
-
id
public EncodingID id()
-
toParam
public EncodingParams toParam()
-
toByteArray
public abstract byte[] toByteArray()
Subclasses but have a defined serialization of their parameters- Returns:
- a byte array representing a specific encoding's parameter values
-
buildCodec
public abstract CRAMCodec<T> buildCodec(BitInputStream coreBlockInputStream, BitOutputStream coreBlockOutputStream, Map<Integer,ByteArrayInputStream> externalBlockInputMap, Map<Integer,ByteArrayOutputStream> externalBlockOutputMap)
Instantiate the codec represented by this encoding by supplying it with the appropriate streams- Parameters:
coreBlockInputStream
- the core block bit stream aCoreCodec
will read fromcoreBlockOutputStream
- the core block bit stream aCoreCodec
will write toexternalBlockInputMap
- the external block byte stream aExternalCodec
will read fromexternalBlockOutputMap
- the external block byte stream aExternalCodec
will write to- Returns:
- a newly instantiated codec
-
buildReadCodec
public CRAMCodec<T> buildReadCodec(BitInputStream coreBlockInputStream, Map<Integer,ByteArrayInputStream> externalBlockInputMap)
Convenience initializer method for read codecs- Parameters:
coreBlockInputStream
- the core block bit stream aCoreCodec
will read fromexternalBlockInputMap
- the external block byte stream aExternalCodec
will read from- Returns:
-
buildWriteCodec
public CRAMCodec<T> buildWriteCodec(BitOutputStream coreBlockOutputStream, Map<Integer,ByteArrayOutputStream> externalBlockOutputMap)
Convenience initializer method for write codecs- Parameters:
coreBlockOutputStream
- the core block bit stream aCoreCodec
will write toexternalBlockOutputMap
- the external block byte stream aExternalCodec
will write to- Returns:
-
-