Package htsjdk.beta.codecs.reads.bam

# Class BAMEncoderOptions

java.lang.Object
htsjdk.beta.codecs.reads.bam.BAMEncoderOptions

public class BAMEncoderOptions extends Object
Encoder options specific to BAM encoders.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`DEAFULT_MAX_RECORDS_IN_RAM`

## Constructor Summary

Constructors
Constructor
Description
`BAMEncoderOptions()`

## Method Summary

Modifier and Type
Method
Description
`int`
`getAsyncOutputBufferSize()`
Get the async output buffer size used for these options.
`int`
`getCompressionLevel()`
Set the compression level for these options.
`DeflaterFactory`
`getDeflaterFactory()`
Get the `DeflaterFactory` for these options.
`int`
`getMaxRecordsInRAM()`
Set the maximum records kept in RAM before spilling to disk for these options.
`int`
`getOutputBufferSize()`
Get the output buffer size for these options.
`IOPath`
`getTemporaryDirectory()`
Get the temporary directory path used for these options.
`boolean`
`isAsyncIO()`
Determine if async IO is enabled for these options.
`BAMEncoderOptions`
`setAsyncIO(boolean asyncIO)`
Set whether to enable async IO for these options.
`BAMEncoderOptions`
`setAsyncOutputBufferSize(int asyncOutputBufferSize)`
Get the async output buffer size used for these options.
`BAMEncoderOptions`
`setCompressionLevel(int compressionLevel)`
Set the compression level for these options.
`BAMEncoderOptions`
`setDeflaterFactory(DeflaterFactory deflaterFactory)`
Set the `DeflaterFactory` for these options for these options.
`BAMEncoderOptions`
`setMaxRecordsInRAM(int maxRecordsInRAM)`
Get the maximum records kept in RAM before spilling to disk for these options.
`BAMEncoderOptions`
`setOutputBufferSize(int outputBufferSize)`
Set the buffer size for these options.
`BAMEncoderOptions`
`setTemporaryDirectory(IOPath tempDirPath)`
Get the temporary directory path for these options.

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

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

## Field Details

### DEAFULT_MAX_RECORDS_IN_RAM

public static final int DEAFULT_MAX_RECORDS_IN_RAM

See Also:
  - Constant Field Values

## Constructor Details

### BAMEncoderOptions

public BAMEncoderOptions()

## Method Details

### getOutputBufferSize

public int getOutputBufferSize()
Get the output buffer size for these options. This determines the size of the output stream buffer used when writing outputs. Default value is `Defaults.BUFFER_SIZE`.

Returns:
  the buffer size for these options

### setOutputBufferSize

public BAMEncoderOptions setOutputBufferSize(int outputBufferSize)
Set the buffer size for these options. This determines the size of the output stream buffer used when writing outputs. Defaults value is `Defaults.BUFFER_SIZE`.

Parameters:
  `outputBufferSize` - the buffer size for these options
Returns:
  updated options

### isAsyncIO

public boolean isAsyncIO()
Determine if async IO is enabled for these options. Defaults to `Defaults.USE_ASYNC_IO_WRITE_FOR_SAMTOOLS`.

Returns:
  true if async IO is enabled, otherwise false

### setAsyncIO

public BAMEncoderOptions setAsyncIO(boolean asyncIO)
Set whether to enable async IO for these options.

Parameters:
  `asyncIO` - true to enable async IO, false to disable.
Returns:
  updated options

### getAsyncOutputBufferSize

public int getAsyncOutputBufferSize()
Get the async output buffer size used for these options. If and only if using asynchronous IO sets the maximum number of records that can be buffered per writer before producers will block when trying to write another record. Defaults to `AbstractAsyncWriter.DEFAULT_QUEUE_SIZE`.

Returns:
  async output buffer size used for these options

### setAsyncOutputBufferSize

public BAMEncoderOptions setAsyncOutputBufferSize(int asyncOutputBufferSize)
Get the async output buffer size used for these options. If and only if using asynchronous IO, sets the maximum number of records that can be buffered per writer before producers will block when trying to write another record.

Parameters:
  `asyncOutputBufferSize` - async output buffer size used for these options
Returns:
  updated options

### getTemporaryDirectory

public IOPath getTemporaryDirectory()
Get the temporary directory path used for these options. The temporary directory path is used for temporary files created during output sorting operations. Defaults value is `IOUtil.getDefaultTmpDirPath()`.

Returns:
  the temp directory path to use for these options

### setTemporaryDirectory

public BAMEncoderOptions setTemporaryDirectory(IOPath tempDirPath)
Get the temporary directory path for these options. The temporary directory path is used for temporary files created during output sorting operations. Defaults value is `IOUtil.getDefaultTmpDirPath()`.

Parameters:
  `tempDirPath` - temporary directory path to use
Returns:
  updated options

### getCompressionLevel

public int getCompressionLevel()
Set the compression level for these options. Defaults value is `BlockCompressedStreamConstants.DEFAULT_COMPRESSION_LEVEL`. See `BlockCompressedStreamConstants.DEFAULT_COMPRESSION_LEVEL`

Returns:
  the compression level for these options, 1 invalid input: '<'= compressionLevel invalid input: '<'= 9

### setCompressionLevel

public BAMEncoderOptions setCompressionLevel(int compressionLevel)
Set the compression level for these options. Defaults value is `BlockCompressedStreamConstants.DEFAULT_COMPRESSION_LEVEL`.

Parameters:
  `compressionLevel` - the compression level for these options, 1 invalid input: '<'= compressionLevel invalid input: '<'= 9
Returns:
  updated options

### getMaxRecordsInRAM

public int getMaxRecordsInRAM()
Set the maximum records kept in RAM before spilling to disk for these options. May be null. Default value is Maximum records in RAM determines the amount of memory used by the writer when sorting output during writing. When writing very large sorted SAM files, you may need use this option in order to avoid running out of file handles. The RAM available to the JVM may need to be increased in order to hold the specified number of records in RAM. Defaults value is `DEAFULT_MAX_RECORDS_IN_RAM`.

Returns:
  the maximum records kept in ram before spilling to disk for these options

### setMaxRecordsInRAM

public BAMEncoderOptions setMaxRecordsInRAM(int maxRecordsInRAM)
Get the maximum records kept in RAM before spilling to disk for these options. Maximum records in RAM determines the amount of memory used by the writer when sorting output during writing. When writing very large sorted SAM files, you may need use this option in order to avoid running out of file handles. The RAM available to the JVM may need to be increased in order to hold the specified number of records in RAM. Defaults value is `DEAFULT_MAX_RECORDS_IN_RAM`.

Parameters:
  `maxRecordsInRAM` - the maximum records kept in ram before spilling to disk. may be null.
Returns:
  updated options

### getDeflaterFactory

public DeflaterFactory getDeflaterFactory()
Get the `DeflaterFactory` for these options. Default value is `BlockCompressedOutputStream.getDefaultDeflaterFactory()`.

Returns:
  the `DeflaterFactory` for these options

### setDeflaterFactory

public BAMEncoderOptions setDeflaterFactory(DeflaterFactory deflaterFactory)
Set the `DeflaterFactory` for these options for these options. Default value is `BlockCompressedOutputStream.getDefaultDeflaterFactory()`.

Parameters:
  `deflaterFactory` - the `DeflaterFactory` for these options
Returns:
  updated options