# Class RANSNx16ExternalCompressor

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

public final class RANSNx16ExternalCompressor extends ExternalCompressor
CRAM external compressor that uses the rANS Nx16 entropy coder (CRAM 3.1). Supports order-0, order-1, bit-packing, RLE, striping, and CAT modes via flag combinations. Wraps shared `RANSNx16Encode` and `RANSNx16Decode` instances to avoid repeated allocation of large internal tables.

## Field Summary

### Fields inherited from class ExternalCompressor

`NO_COMPRESSION_ARG`

## Constructor Summary

Constructors
Constructor
Description
`RANSNx16ExternalCompressor(int flags, RANSNx16Encode ransEncode, RANSNx16Decode ransDecode)`
Create a rANS Nx16 compressor with the specified flag combination.
`RANSNx16ExternalCompressor(RANSNx16Encode ransEncode, RANSNx16Decode ransDecode)`
We use a shared RANS instance for all compressors.

## 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

### RANSNx16ExternalCompressor

public RANSNx16ExternalCompressor(RANSNx16Encode ransEncode, RANSNx16Decode ransDecode)
We use a shared RANS instance for all compressors.

Parameters:
  `ransEncode` -
  `ransDecode` -

### RANSNx16ExternalCompressor

public RANSNx16ExternalCompressor(int flags, RANSNx16Encode ransEncode, RANSNx16Decode ransDecode)
Create a rANS Nx16 compressor with the specified flag combination.

Parameters:
  `flags` - bitmask of rANS Nx16 flags (order, pack, RLE, stripe, etc.)
  `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`