Package htsjdk.samtools
Class BAMStreamWriter
java.lang.Object
htsjdk.samtools.BAMStreamWriter
Class for writing SAMRecords in BAM format to an output stream.
-
Constructor Summary
ConstructorDescriptionBAMStreamWriter
(OutputStream outputStream, OutputStream indexStream, OutputStream sbiStream, long sbiGranularity, SAMFileHeader header) Create a BAMStreamWriter for writing. -
Method Summary
Modifier and TypeMethodDescriptionvoid
finish
(boolean writeTerminatorBlock) Finish writing and close all the streams.void
writeAlignment
(SAMRecord alignment) void
writeHeader
(SAMFileHeader header)
-
Constructor Details
-
BAMStreamWriter
public BAMStreamWriter(OutputStream outputStream, OutputStream indexStream, OutputStream sbiStream, long sbiGranularity, SAMFileHeader header) Create a BAMStreamWriter for writing. All output streams should be uncompressed streams, since this class performs the necessary compression. All output streams are closed by this class afterfinish(boolean)
returns.- Parameters:
outputStream
- an output stream for the main BAM outputindexStream
- an output stream for the BAI index, or null if no index is requiredsbiStream
- an output stream for the SBI index, or null if no index is requiredsbiGranularity
- the granularity of the SBI index (reads per entry)header
- the SAM header
-
-
Method Details
-
writeHeader
-
writeAlignment
-
finish
public void finish(boolean writeTerminatorBlock) Finish writing and close all the streams.- Parameters:
writeTerminatorBlock
- whether to write a BAM terminator block to the main output stream
-