Class SliceBlocksWriteStreams

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

public class SliceBlocksWriteStreams extends Object
Provides a layer over a SliceBlocks object and acts as a bridge between the DataSeries codecs and their underlying blocks when writing a CRAM stream by presenting a bit (core) or byte (external) stream for each block.

External block streams use unsynchronized CRAMByteWriter instead of ByteArrayOutputStream to eliminate synchronized method call overhead in the hot encode path.

  • Constructor Details

    • SliceBlocksWriteStreams

      public SliceBlocksWriteStreams(CompressionHeader compressionHeader)
      Parameters:
      compressionHeader - CompressionHeader for the container containing the slice
  • Method Details

    • getCoreOutputStream

      public BitOutputStream getCoreOutputStream()
      Returns:
      the BitOutputStream for the core block
    • getExternalWriter

      public CRAMByteWriter getExternalWriter(Integer contentID)
      Get the CRAMByteWriter corresponding to the requested content ID.
      Parameters:
      contentID - ID of content being requested
      Returns:
      CRAMByteWriter for the content ID
    • flushStreamsToBlocks

      public SliceBlocks flushStreamsToBlocks(CRAMCodecModelContext contextModel)
      Compress and write each stream to a corresponding Block.