# Class CompressorCache

java.lang.Object
htsjdk.samtools.cram.structure.CompressorCache

public class CompressorCache extends Object
Maintain a cache of reusable compressor instances in order to reduce the need to repeatedly instantiate them, since some, like the RANS de/compressor, allocate large numbers (~256k) of small temporary objects every time they're instantiated.

## Constructor Summary

Constructors
Constructor
Description
`CompressorCache()`

## Method Summary

Modifier and Type
Method
Description
`ExternalCompressor`
`getCompressorForMethod(BlockCompressionMethod compressionMethod, int compressorSpecificArg)`
Return a compressor if it's in our cache, otherwise spin one up and cache it and return it.

### Methods inherited from class Object

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

## Constructor Details

### CompressorCache

public CompressorCache()

## Method Details

### getCompressorForMethod

public ExternalCompressor getCompressorForMethod(BlockCompressionMethod compressionMethod, int compressorSpecificArg)
Return a compressor if it's in our cache, otherwise spin one up and cache it and return it.

Parameters:
  `compressionMethod` -
  `compressorSpecificArg` -
Returns:
  a cached compressor instance