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 by DataSeriesType, but logically it must be a type that corresponds to one of the DataSeriesType "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

public abstract class CRAMEncoding<T> extends Object
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 Details

    • CRAMEncoding

      protected CRAMEncoding(EncodingID encodingId)
      Create a new encoding. Concrete implementation constructors will specify their parameters
      Parameters:
      encodingId - the EncodingID associated with the concrete implementation
  • Method Details

    • id

      public EncodingID id()
    • toEncodingDescriptor

      public EncodingDescriptor 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
      Parameters:
      sliceBlocksReadStreams - the core block bit stream a CoreCodec will read from
      sliceBlocksWriteStreams - the core block bit stream a CoreCodec will write to
      Returns:
      a newly instantiated codec
    • buildReadCodec

      public CRAMCodec<T> buildReadCodec(SliceBlocksReadStreams sliceBlocksReadStreams)
      Convenience initializer method for read codecs
      Parameters:
      sliceBlocksReadStreams - the core block bit stream a CoreCodec will read from
      Returns:
    • buildWriteCodec

      public CRAMCodec<T> buildWriteCodec(SliceBlocksWriteStreams sliceBlocksWriteStreams)
      Convenience initializer method for write codecs
      Parameters:
      sliceBlocksWriteStreams - the core block bit stream a CoreCodec will write to
      Returns: