# Class ByteArrayLenEncoding

java.lang.Object
htsjdk.samtools.cram.encoding.CRAMEncoding<byte[]>
htsjdk.samtools.cram.encoding.ByteArrayLenEncoding

public class ByteArrayLenEncoding extends CRAMEncoding<byte[]>
NOTE: this encoding can be a hybrid encoding in that it ALLOWS for the possibility to split it's data between the core block and an external block (i.e., if lenEncoding is CORE and byteEncoding is EXTERNAL) This has implications for data access, since some of it's data is interleaved with other data in the core block.

## Constructor Summary

Constructors
Constructor
Description
`ByteArrayLenEncoding(CRAMEncoding<Integer> lenEncoding, CRAMEncoding<byte[]> byteEncoding)`
Note: depending on the sub-encodings, this encoding can wind up being a core/external hybrid.

## Method Summary

Modifier and Type
Method
Description
`CRAMCodec<byte[]>`
`buildCodec(SliceBlocksReadStreams sliceBlocksReadStreams, SliceBlocksWriteStreams sliceBlocksWriteStreams)`
Instantiate the codec represented by this encoding by supplying it with the appropriate streams
`static ByteArrayLenEncoding`
`fromSerializedEncodingParams(byte[] serializedParams)`
Create a new instance of this encoding using the (ITF8 encoded) serializedParams.
`byte[]`
`toSerializedEncodingParams()`
Serialize encoding parameters to an ITF8-encoded byte array.
`String`
`toString()`

### Methods inherited from class CRAMEncoding

`buildReadCodec, buildWriteCodec, id, toEncodingDescriptor`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ByteArrayLenEncoding

public ByteArrayLenEncoding(CRAMEncoding<Integer> lenEncoding, CRAMEncoding<byte[]> byteEncoding)
Note: depending on the sub-encodings, this encoding can wind up being a core/external hybrid. See https://github.com/samtools/hts-specs/issues/426).

## Method Details

### fromSerializedEncodingParams

public static ByteArrayLenEncoding fromSerializedEncodingParams(byte[] serializedParams)
Create a new instance of this encoding using the (ITF8 encoded) serializedParams.

Parameters:
  `serializedParams` -
Returns:
  ByteArrayLenEncoding with parameters populated from serializedParams

### toSerializedEncodingParams

public byte[] toSerializedEncodingParams()
Description copied from class: `CRAMEncoding`
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.

Specified by:
  `toSerializedEncodingParams` in class `CRAMEncoding<byte[]>`
Returns:
  a byte array containing the encoding's parameter values encoded as an ITF8 stream.

### buildCodec

public CRAMCodec<byte[]> buildCodec(SliceBlocksReadStreams sliceBlocksReadStreams, SliceBlocksWriteStreams sliceBlocksWriteStreams)
Description copied from class: `CRAMEncoding`
Instantiate the codec represented by this encoding by supplying it with the appropriate streams

Specified by:
  `buildCodec` in class `CRAMEncoding<byte[]>`
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

### toString

public String toString()

Overrides:
  `toString` in class `Object`