# Class CRAMCodecModelContext

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

public class CRAMCodecModelContext extends Object
Context model data for use by CRAM 3.1 codec write implementations that need per-record metadata beyond the raw byte stream. Populated during slice construction from the list of CRAM records, then passed through to `ExternalCompressor.compress(byte[], CRAMCodecModelContext)` calls. Currently used by FQZComp, which needs per-record quality score lengths and BAM flags to properly compress quality scores with context modeling.

## Constructor Summary

Constructors
Constructor
Description
`CRAMCodecModelContext()`

## Method Summary

Modifier and Type
Method
Description
`int[]`
`getBamFlags()`
`int`
`getNumRecords()`
`int[]`
`getQualityScoreLengths()`
`void`
`populateFromRecords(List<CRAMCompressionRecord> records)`
Populate this context from the records in a slice.

### Methods inherited from class Object

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

## Constructor Details

### CRAMCodecModelContext

public CRAMCodecModelContext()

## Method Details

### populateFromRecords

public void populateFromRecords(List<CRAMCompressionRecord> records)
Populate this context from the records in a slice. Should be called during slice construction before records are written to blocks.

Parameters:
  `records` - the CRAM records for this slice

### getQualityScoreLengths

public int[] getQualityScoreLengths()

Returns:
  per-record quality score lengths (one per record in the slice), or null if not populated

### getBamFlags

public int[] getBamFlags()

Returns:
  per-record BAM flags (one per record in the slice), or null if not populated

### getNumRecords

public int getNumRecords()

Returns:
  number of records, or 0 if not populated