Package htsjdk.samtools
Class SBIIndexWriter
- java.lang.Object
-
- htsjdk.samtools.SBIIndexWriter
-
public final class SBIIndexWriter extends Object
Writes SBI files as understood bySBIIndex.To use this class, first construct an instance from an output stream, and a desired granularity. Then for each record in the file being indexed, pass the virtual file offset of the record to the
processRecord(long)method. The indexer will keep a count of the records passed in an index every nth record. When there are no records left callfinish(long, long)to complete writing the index.
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_GRANULARITY
-
Constructor Summary
Constructors Constructor Description SBIIndexWriter(OutputStream out)Prepare to write an SBI index with the default granularity.SBIIndexWriter(OutputStream out, long granularity)Prepare to write an SBI index.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfinish(long finalVirtualOffset, long dataFileLength)Complete the index, and close the output stream.voidfinish(long finalVirtualOffset, long dataFileLength, byte[] md5, byte[] uuid)Complete the index, and close the output stream.voidprocessRecord(long virtualOffset)Process a record for the index: the offset of every nth record will be written to the index.
-
-
-
Field Detail
-
DEFAULT_GRANULARITY
public static final long DEFAULT_GRANULARITY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SBIIndexWriter
public SBIIndexWriter(OutputStream out)
Prepare to write an SBI index with the default granularity.- Parameters:
out- the stream to write the index to
-
SBIIndexWriter
public SBIIndexWriter(OutputStream out, long granularity)
Prepare to write an SBI index.- Parameters:
out- the stream to write the index togranularity- write the offset of every nth record to the index
-
-
Method Detail
-
processRecord
public void processRecord(long virtualOffset)
Process a record for the index: the offset of every nth record will be written to the index.- Parameters:
virtualOffset- virtual file pointer of the record
-
finish
public void finish(long finalVirtualOffset, long dataFileLength)Complete the index, and close the output stream.- Parameters:
finalVirtualOffset- the virtual offset at which the next record would start if it were added to the filedataFileLength- the length of the data file in bytes
-
finish
public void finish(long finalVirtualOffset, long dataFileLength, byte[] md5, byte[] uuid)Complete the index, and close the output stream.- Parameters:
finalVirtualOffset- the virtual offset at which the next record would start if it were added to the filedataFileLength- the length of the data file in bytesmd5- the MD5 hash of the data file, or null if not specifieduuid- the UUID for the data file, or null if not specified
-
-