public class BinarySearchOnSortedFile extends Object implements BinarySearcher
| Modifier and Type | Field and Description |
|---|---|
protected Seekable |
baseSeekable |
protected long |
channelSize |
protected AutoCloseable |
closeAction |
protected byte |
delimiter |
| Constructor and Description |
|---|
BinarySearchOnSortedFile(AutoCloseable closeAction,
Seekable baseSeekable,
long baseSeekableSize,
byte delimiter) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static BinarySearchOnSortedFile |
create(Path path) |
static long |
getPosOfFirstMatch(Seekable seekable,
byte delimiter,
byte[] prefix)
The initial position is assumed point to the delimiter
The result will point to the initial position or a preceding delimiter
If there is no preceding delimiter, the seekable will be positioned before start
|
static InputStream |
newInputStream(Seekable channel,
BinSearchScanState state) |
InputStream |
search(byte[] prefixBytes) |
InputStream |
search(String prefix)
The high-level search method.
|
InputStream |
searchCore(String prefix) |
protected Seekable baseSeekable
protected AutoCloseable closeAction
protected long channelSize
protected byte delimiter
public BinarySearchOnSortedFile(AutoCloseable closeAction, Seekable baseSeekable, long baseSeekableSize, byte delimiter)
public static BinarySearchOnSortedFile create(Path path) throws IOException
IOExceptionpublic static InputStream newInputStream(Seekable channel, BinSearchScanState state)
public InputStream search(String prefix)
search in interface BinarySearcherprefix - public InputStream searchCore(String prefix) throws IOException
IOExceptionpublic InputStream search(byte[] prefixBytes) throws IOException
search in interface BinarySearcherIOExceptionpublic static long getPosOfFirstMatch(Seekable seekable, byte delimiter, byte[] prefix) throws IOException
seekable - delimiter - prefix - IOExceptionpublic void close()
throws Exception
close in interface AutoCloseableclose in interface BinarySearcherExceptionCopyright © 2020. All rights reserved.