Class BinarySearcherOverPlainSource
java.lang.Object
org.aksw.commons.io.hadoop.binseach.v2.BinarySearcherOverPlainSource
- All Implemented Interfaces:
AutoCloseable,BinarySearcher
Binary search over an non-encoded SeekableInputStreams.
Non-encoded means that every byte is individually addressable
(in contrast to block-based stream/channels).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Supplier<org.aksw.commons.io.hadoop.binseach.v2.BinSearchResourceCache.CacheEntry>protected SeekableReadableChannelSource<byte[]> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBinarySearcherOverPlainSource(SeekableReadableChannelSource<byte[]> source, Supplier<org.aksw.commons.io.hadoop.binseach.v2.BinSearchResourceCache.CacheEntry> cacheSupplier) -
Method Summary
Modifier and TypeMethodDescriptionstatic MatchbinarySearch(SeekableInputStream channel, long end, byte[] prefix) static MatchbinarySearch(SeekableInputStream in, SearchMode searchMode, int depth, long start, long end, long knownDelimPos, byte delimiter, byte[] prefix, BinSearchLevelCache cache) When this method returns the input stream's position is unspecified.voidclose()of(Path path, Supplier<org.aksw.commons.io.hadoop.binseach.v2.BinSearchResourceCache.CacheEntry> cacheSupplier) of(SeekableReadableChannelSource<byte[]> source, Supplier<org.aksw.commons.io.hadoop.binseach.v2.BinSearchResourceCache.CacheEntry> cacheSupplier) Stream<ReadableChannelSupplier<byte[]>>parallelSearch(byte[] prefix) search(byte[] prefix) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aksw.commons.io.binseach.BinarySearcher
search
-
Field Details
-
source
-
cacheSupplier
protected Supplier<org.aksw.commons.io.hadoop.binseach.v2.BinSearchResourceCache.CacheEntry> cacheSupplier
-
-
Constructor Details
-
BinarySearcherOverPlainSource
protected BinarySearcherOverPlainSource(SeekableReadableChannelSource<byte[]> source, Supplier<org.aksw.commons.io.hadoop.binseach.v2.BinSearchResourceCache.CacheEntry> cacheSupplier)
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBinarySearcher- Throws:
Exception
-
binarySearch
public static Match binarySearch(SeekableInputStream channel, long end, byte[] prefix) throws IOException - Throws:
IOException
-
of
public static BinarySearcherOverPlainSource of(SeekableReadableChannelSource<byte[]> source, Supplier<org.aksw.commons.io.hadoop.binseach.v2.BinSearchResourceCache.CacheEntry> cacheSupplier) -
of
public static BinarySearcherOverPlainSource of(Path path, Supplier<org.aksw.commons.io.hadoop.binseach.v2.BinSearchResourceCache.CacheEntry> cacheSupplier) -
search
- Specified by:
searchin interfaceBinarySearcher- Throws:
IOException
-
parallelSearch
- Specified by:
parallelSearchin interfaceBinarySearcher- Throws:
IOException
-
binarySearch
public static Match binarySearch(SeekableInputStream in, SearchMode searchMode, int depth, long start, long end, long knownDelimPos, byte delimiter, byte[] prefix, BinSearchLevelCache cache) throws IOException When this method returns the input stream's position is unspecified.- Parameters:
in- The seekable input stream on which to perform binary search for the given prefix.searchMode- Whether we are searching the initial match, or the start or end of a run of matches.start-end-delimiter-prefix-- Returns:
- Throws:
IOException
-