public interface Seekable extends ReadableByteChannel
| Modifier and Type | Method and Description |
|---|---|
default long |
binarySearch(long min,
long max,
byte delimiter,
byte[] prefix)
Delimiter-based binary search.
|
int |
checkNext(int len,
boolean changePos)
Attempt to advance the position by the given number of bytes.
|
int |
checkPrev(int len,
boolean changePos) |
Seekable |
clone() |
default Seekable |
cloneObject()
Default method to work around scala bug
https://github.com/scala/bug/issues/10501
|
void |
close() |
static int |
compareArrays(byte[] a,
byte[] b) |
default int |
compareToPrefix(byte[] prefix)
Compare the bytes at the current position to a given sequence of bytes
If there are fewer bytes available in the seekable than provide for comparison,
then only that many are compared.
|
default boolean |
deltaPos(int delta)
Relative positioning.
|
default byte |
get()
Read a byte at the current position
|
default byte |
get(long pos)
Move to 1 byte beyond the know end
|
long |
getPos()
Optional operation.
|
boolean |
isPosAfterEnd()
The state of a seekable may be one unit beyond the end.
|
boolean |
isPosBeforeStart()
The state of a seekable may be one unit before the start.
|
default boolean |
nextPos(int len)
Attempt to advance the position by the given number of bytes.
|
default int |
peekNextBytes(byte[] dst,
int offset,
int len)
Attempt to read bytes at the current position without altering the position
|
void |
posToEnd()
Optional operation.
|
default boolean |
posToNext(byte delimiter)
Move the position to the next delimiter if it exists.
|
default int |
posToNext(byte delimiter,
boolean changePos)
0: match but 0 bytes moved
negative values indicate no match.
|
default boolean |
posToPrev(byte delimiter)
Move the position to the previous delimiter if it exists,
or one element past the end of data such that isPosBeforeStart() yields true.
|
void |
posToStart()
Optional operation.
|
default boolean |
prevPos(int len)
Attempt to step back the position by the given number of bytes.
|
default int |
read(ByteBuffer dst) |
String |
readString(int len) |
void |
setPos(long pos)
Optional operation.
|
default long |
size() |
Seekable clone()
default Seekable cloneObject()
long getPos()
throws IOException
IOExceptionvoid setPos(long pos)
throws IOException
IOExceptionvoid posToStart()
throws IOException
IOExceptionvoid posToEnd()
throws IOException
IOExceptiondefault byte get(long pos)
throws IOException
IOExceptiondefault byte get()
throws IOException
IOExceptionboolean isPosBeforeStart()
throws IOException
IOExceptionboolean isPosAfterEnd()
throws IOException
IOExceptiondefault boolean nextPos(int len)
throws IOException
len - IOExceptionint checkNext(int len,
boolean changePos)
throws IOException
len - IOExceptiondefault boolean prevPos(int len)
throws IOException
len - IOExceptionint checkPrev(int len,
boolean changePos)
throws IOException
IOExceptiondefault boolean deltaPos(int delta)
throws IOException
delta - IOExceptiondefault int peekNextBytes(byte[] dst,
int offset,
int len)
throws IOException
dst - offset - len - IOExceptiondefault boolean posToNext(byte delimiter)
throws IOException
delimiter - IOExceptiondefault int posToNext(byte delimiter,
boolean changePos)
throws IOException
delimiter - changePos - If no delimiter is found, move the pos to the endIOExceptiondefault boolean posToPrev(byte delimiter)
throws IOException
delimiter - IOExceptiondefault int read(ByteBuffer dst) throws IOException
read in interface ReadableByteChannelIOExceptionString readString(int len) throws IOException
IOExceptiondefault int compareToPrefix(byte[] prefix)
throws IOException
prefix - IOExceptionstatic int compareArrays(byte[] a,
byte[] b)
default long binarySearch(long min,
long max,
byte delimiter,
byte[] prefix)
throws IOException
min - max - delimiter - prefix - IOExceptionvoid close()
throws IOException
close in interface AutoCloseableclose in interface Channelclose in interface CloseableIOExceptiondefault long size()
throws IOException
IOExceptionCopyright © 2020. All rights reserved.