# Class ContainerHeader

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

public class ContainerHeader extends Object

## Constructor Summary

Constructors
Constructor
Description
`ContainerHeader(CRAMVersion cramVersion, InputStream inputStream)`
Create a container header from an `InputStream`.
`ContainerHeader(AlignmentContext alignmentContext, int blockCount, int containerBlocksByteSize, int recordCount, long globalRecordCounter, long baseCount, List<Integer> landmarks, int checksum)`
Create a ContainerHeader.
`ContainerHeader(AlignmentContext alignmentContext, int blockCount, int recordCount, long globalRecordCounter, int baseCount)`
Create a Container from a partial set of values.

## Method Summary

Modifier and Type
Method
Description
`AlignmentContext`
`getAlignmentContext()`
`long`
`getBaseCount()`
`int`
`getBlockCount()`
`int`
`getChecksum()`
`int`
`getContainerBlocksByteSize()`
`long`
`getGlobalRecordCounter()`
`List<Integer>`
`getLandmarks()`
`int`
`getNumberOfRecords()`
`boolean`
`isEOF()`
`static ContainerHeader`
`makeSAMFileHeaderContainer(int containerBlocksByteSize)`
Create a ContainerHeader for a SAMFileHeader container.
`void`
`setContainerBlocksByteSize(int containerBlocksByteSize)`
`void`
`setLandmarks(List<Integer> landmarks)`
`String`
`toString()`
`int`
`write(CRAMVersion cramVersion, OutputStream outputStream)`
Write CRAM `Container` (header only) out into the given `OutputStream`.

### Methods inherited from class Object

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

## Constructor Details

### ContainerHeader

public ContainerHeader(AlignmentContext alignmentContext, int blockCount, int containerBlocksByteSize, int recordCount, long globalRecordCounter, long baseCount, List<Integer> landmarks, int checksum)
Create a ContainerHeader.

Parameters:
  `alignmentContext` - the alignment context for this container
  `blockCount` - block count for this container
  `containerBlocksByteSize` -
  `recordCount` - record count for this container
  `globalRecordCounter` - global record count for this container
  `baseCount` - base count for this container
  `landmarks` - List of landmarks for this container (may be empty)
  `checksum` -

### ContainerHeader

public ContainerHeader(AlignmentContext alignmentContext, int blockCount, int recordCount, long globalRecordCounter, int baseCount)
Create a Container from a partial set of values. Used in cases where we don't yet have all of the values (such as landmarks, which, being stream offsets, can't be calculated until the container is written out to a stream).

Parameters:
  `alignmentContext` - the alignment context for this container
  `blockCount` - block count for this container
  `recordCount` - record count for this container
  `globalRecordCounter` - global record count for this container
  `baseCount` - base count for this container

### ContainerHeader

public ContainerHeader(CRAMVersion cramVersion, InputStream inputStream)
Create a container header from an `InputStream`. Populates the container header values but leaves the body empty (no slices and blocks).

Parameters:
  `cramVersion` - the CRAM version to assume
  `inputStream` - the input stream from which to read

## Method Details

### makeSAMFileHeaderContainer

public static ContainerHeader makeSAMFileHeaderContainer(int containerBlocksByteSize)
Create a ContainerHeader for a SAMFileHeader container.

Parameters:
  `containerBlocksByteSize` - size of the SAMFileHeader block to be embedded in this container

### getContainerBlocksByteSize

public int getContainerBlocksByteSize()

### setContainerBlocksByteSize

public void setContainerBlocksByteSize(int containerBlocksByteSize)

### getAlignmentContext

public AlignmentContext getAlignmentContext()

### getNumberOfRecords

public int getNumberOfRecords()

### getGlobalRecordCounter

public long getGlobalRecordCounter()

### getBaseCount

public long getBaseCount()

### getBlockCount

public int getBlockCount()

### getLandmarks

public List<Integer> getLandmarks()

### setLandmarks

public void setLandmarks(List<Integer> landmarks)

### getChecksum

public int getChecksum()

### write

public int write(CRAMVersion cramVersion, OutputStream outputStream)
Write CRAM `Container` (header only) out into the given `OutputStream`.

Parameters:
  `cramVersion` - CRAM version
  `outputStream` - the output stream to write the container header to
Returns:
  number of bytes written out to the output stream

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### isEOF

public boolean isEOF()