public class SequentialOffsetIndex extends Object implements OffsetIndex
| Constructor and Description |
|---|
SequentialOffsetIndex(Buffer buffer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the index.
|
boolean |
contains(long offset)
Returns a boolean value indicating whether the index contains the given offset.
|
void |
delete()
Deletes the index.
|
long |
find(long offset)
Finds the real offset for the given relative offset.
|
void |
flush()
Flushes the index to the underlying storage.
|
boolean |
index(long offset,
long position)
Indexes the given offset with the given position.
|
boolean |
isEmpty()
Returns a boolean value indicating whether the index is empty.
|
long |
lastOffset()
Returns the last offset in the index.
|
long |
position(long offset)
Finds the starting position of the given offset.
|
int |
size()
Returns the number of entries active in the index.
|
long |
truncate(long offset)
Truncates the index up to the given offset.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsizepublic SequentialOffsetIndex(Buffer buffer)
NullPointerException - if buffer is nullpublic long lastOffset()
OffsetIndexlastOffset in interface OffsetIndexpublic boolean index(long offset,
long position)
OffsetIndexindex in interface OffsetIndexoffset - The offset to index.position - The position of the offset to index.public boolean isEmpty()
OffsetIndexisEmpty in interface OffsetIndexpublic int size()
OffsetIndexsize in interface OffsetIndexpublic boolean contains(long offset)
OffsetIndexcontains in interface OffsetIndexoffset - The offset to check.public long position(long offset)
OffsetIndexposition in interface OffsetIndexoffset - The offset to look up.public long find(long offset)
OffsetIndexfind in interface OffsetIndexpublic long truncate(long offset)
OffsetIndexThis method assumes that the given offset is contained within the index. If the offset is not indexed then the index will not be truncated.
truncate in interface OffsetIndexoffset - The offset after which to truncate the index.public void flush()
OffsetIndexflush in interface OffsetIndexpublic void close()
OffsetIndexclose in interface OffsetIndexclose in interface AutoCloseablepublic void delete()
OffsetIndexdelete in interface OffsetIndexCopyright © 2013–2016. All rights reserved.