public final class SBIIndexWriter
extends java.lang.Object
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.
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_GRANULARITY |
| Constructor and Description |
|---|
SBIIndexWriter(java.io.OutputStream out)
Prepare to write an SBI index with the default granularity.
|
SBIIndexWriter(java.io.OutputStream out,
long granularity)
Prepare to write an SBI index.
|
| Modifier and Type | Method and Description |
|---|---|
void |
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.
|
public static final long DEFAULT_GRANULARITY
public SBIIndexWriter(java.io.OutputStream out)
out - the stream to write the index topublic SBIIndexWriter(java.io.OutputStream out,
long granularity)
out - the stream to write the index togranularity - write the offset of every nth record to the indexpublic void processRecord(long virtualOffset)
virtualOffset - virtual file pointer of the recordpublic void finish(long finalVirtualOffset,
long dataFileLength)
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 bytespublic void finish(long finalVirtualOffset,
long dataFileLength,
byte[] md5,
byte[] uuid)
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