Package htsjdk.samtools.cram.encoding.external

# Class ExternalByteArrayCodec

java.lang.Object
htsjdk.samtools.cram.encoding.external.ExternalByteArrayCodec

All Implemented Interfaces:
  `CRAMCodec<byte[]>`

public final class ExternalByteArrayCodec extends Object
Encode Byte Arrays using an External Data Block

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final ByteArrayInputStream`
`inputStream`
`protected final ByteArrayOutputStream`
`outputStream`

## Constructor Summary

Constructors
Constructor
Description
`ExternalByteArrayCodec(ByteArrayInputStream inputStream, ByteArrayOutputStream outputStream)`
Construct an External Codec for Byte Arrays

## Method Summary

Modifier and Type
Method
Description
`byte[]`
`read()`
Read a single object from the stream
`byte[]`
`read(int length)`
Read a array of specified length from the stream
`void`
`write(byte[] object)`
Write an object to the stream

### Methods inherited from class java.lang.Object

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

## Field Details

### inputStream

protected final ByteArrayInputStream inputStream

### outputStream

protected final ByteArrayOutputStream outputStream

## Constructor Details

### ExternalByteArrayCodec

public ExternalByteArrayCodec(ByteArrayInputStream inputStream, ByteArrayOutputStream outputStream)
Construct an External Codec for Byte Arrays

Parameters:
  `inputStream` - the input bytestream to read from
  `outputStream` - the output bytestream to write to

## Method Details

### read

public byte[] read(int length)
Description copied from interface: `CRAMCodec`
Read a array of specified length from the stream

Parameters:
  `length` - the number of elements to read
Returns:
  an object from the stream

### write

public void write(byte[] object)
Description copied from interface: `CRAMCodec`
Write an object to the stream

Parameters:
  `object` - the object to write

### read

public byte[] read()
Description copied from interface: `CRAMCodec`
Read a single object from the stream

Returns:
  an object from the stream