Package htsjdk.samtools
Class SBIIndexWriter
java.lang.Object
htsjdk.samtools.SBIIndexWriter
Writes SBI files as understood by
SBIIndex
.
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 call finish(long, long)
to complete writing the index.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPrepare to write an SBI index with the default granularity.SBIIndexWriter
(OutputStream out, long granularity) Prepare to write an SBI index. -
Method Summary
Modifier and TypeMethodDescriptionvoid
finish
(long finalVirtualOffset, long dataFileLength) Complete the index, and close the output stream.void
finish
(long finalVirtualOffset, long dataFileLength, byte[] md5, byte[] uuid) Complete the index, and close the output stream.void
processRecord
(long virtualOffset) Process a record for the index: the offset of every nth record will be written to the index.
-
Field Details
-
DEFAULT_GRANULARITY
public static final long DEFAULT_GRANULARITY- See Also:
-
-
Constructor Details
-
SBIIndexWriter
Prepare to write an SBI index with the default granularity.- Parameters:
out
- the stream to write the index to
-
SBIIndexWriter
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 Details
-
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
-