Package htsjdk.samtools
Class BAMStreamWriter
- java.lang.Object
-
- htsjdk.samtools.BAMStreamWriter
-
public class BAMStreamWriter extends Object
Class for writing SAMRecords in BAM format to an output stream.
-
-
Constructor Summary
Constructors Constructor Description BAMStreamWriter(OutputStream outputStream, OutputStream indexStream, OutputStream sbiStream, long sbiGranularity, SAMFileHeader header)
Create a BAMStreamWriter for writing.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finish(boolean writeTerminatorBlock)
Finish writing and close all the streams.void
writeAlignment(SAMRecord alignment)
void
writeHeader(SAMFileHeader header)
-
-
-
Constructor Detail
-
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 Detail
-
writeHeader
public void writeHeader(SAMFileHeader header)
-
writeAlignment
public void writeAlignment(SAMRecord alignment)
-
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
-
-