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 aCRAMCodecinstance.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCRAMEncoding(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 codecsEncodingIDid()abstract byte[]toByteArray()Subclasses but have a defined serialization of their parametersEncodingParamstoParam()
-
-
-
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 aCoreCodecwill read fromcoreBlockOutputStream- the core block bit stream aCoreCodecwill write toexternalBlockInputMap- the external block byte stream aExternalCodecwill read fromexternalBlockOutputMap- the external block byte stream aExternalCodecwill 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 aCoreCodecwill read fromexternalBlockInputMap- the external block byte stream aExternalCodecwill 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 aCoreCodecwill write toexternalBlockOutputMap- the external block byte stream aExternalCodecwill write to- Returns:
-
-