# Class RANS4x8ExternalCompressor

java.lang.Object
htsjdk.samtools.cram.compression.ExternalCompressor
htsjdk.samtools.cram.compression.RANS4x8ExternalCompressor

public final class RANS4x8ExternalCompressor extends ExternalCompressor
CRAM external compressor that uses the rANS 4x8 entropy coder (CRAM 3.0). Wraps shared `RANS4x8Encode` and `RANS4x8Decode` instances to avoid repeated allocation of large internal tables.

## Field Summary

### Fields inherited from class ExternalCompressor

`NO_COMPRESSION_ARG`

## Constructor Summary

Constructors
Constructor
Description
`RANS4x8ExternalCompressor(int order, RANS4x8Encode ransEncode, RANS4x8Decode ransDecode)`
Create a rANS 4x8 compressor with the specified order (as an integer).
`RANS4x8ExternalCompressor(RANS4x8Encode ransEncode, RANS4x8Decode ransDecode)`
We use a shared RANS instance for all compressors.
`RANS4x8ExternalCompressor(RANSParams.ORDER order, RANS4x8Encode ransEncode, RANS4x8Decode ransDecode)`
Create a rANS 4x8 compressor with the specified order.

## Method Summary

Modifier and Type
Method
Description
`byte[]`
`compress(byte[] data, CRAMCodecModelContext unused_contextModel)`
Compress the data using the codec-specific context model.
`boolean`
`equals(Object o)`
`int`
`hashCode()`
`String`
`toString()`
`byte[]`
`uncompress(byte[] data)`
Decompress the data.

### Methods inherited from class ExternalCompressor

`getCompressorForMethod, getMethod, setMethod`

### Methods inherited from class Object

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

## Constructor Details

### RANS4x8ExternalCompressor

public RANS4x8ExternalCompressor(RANS4x8Encode ransEncode, RANS4x8Decode ransDecode)
We use a shared RANS instance for all compressors.

Parameters:
  `ransEncode` - ransEncoder to use
  `ransDecode` - ransDecoder to use

### RANS4x8ExternalCompressor

public RANS4x8ExternalCompressor(int order, RANS4x8Encode ransEncode, RANS4x8Decode ransDecode)
Create a rANS 4x8 compressor with the specified order (as an integer).

Parameters:
  `order` - the rANS order (0 or 1)
  `ransEncode` - shared encoder instance
  `ransDecode` - shared decoder instance

### RANS4x8ExternalCompressor

public RANS4x8ExternalCompressor(RANSParams.ORDER order, RANS4x8Encode ransEncode, RANS4x8Decode ransDecode)
Create a rANS 4x8 compressor with the specified order.

Parameters:
  `order` - the rANS order (ZERO or ONE)
  `ransEncode` - shared encoder instance
  `ransDecode` - shared decoder instance

## Method Details

### compress

public byte[] compress(byte[] data, CRAMCodecModelContext unused_contextModel)
Description copied from class: `ExternalCompressor`
Compress the data using the codec-specific context model.

Specified by:
  `compress` in class `ExternalCompressor`
Parameters:
  `data` - the data to compress
  `unused_contextModel` - the context model to use for compression; may be null
Returns:
  the compressed data

### uncompress

public byte[] uncompress(byte[] data)
Description copied from class: `ExternalCompressor`
Decompress the data.

Specified by:
  `uncompress` in class `ExternalCompressor`
Parameters:
  `data` - the compressed data
Returns:
  the decompressed data

### toString

public String toString()

Overrides:
  `toString` in class `ExternalCompressor`

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `ExternalCompressor`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `ExternalCompressor`