Simple implementation of ChecksumIndexInput that wraps another input and delegates calls.
Creates a new BufferedChecksumIndexInput
getChecksum() · also: get_checksumclose()getFilePointer() · also: get_file_pointerlength()readByte()readBytes(byte[] b, int offset, int len)readInt()readLong()readLongs(long[] dst, int offset, int length)readShort()slice(String sliceDescription, long offset, long length)readBytes(byte[] b, int offset, int len, boolean useBuffer)Reads a specified number of bytes into an array at the specified offset with control over
whether the read should be buffered (callers who have their own buffer should pass in "false"
for useBuffer). Currently only BufferedIndexInput respects this parameter.
| name | type | description |
|---|---|---|
| b | byte[] | the array to read bytes into |
| offset | int | the offset in the array to start storing bytes |
| len | int | the number of bytes to read |
| use_buffer | boolean | set to false if the caller will handle buffering. |
readFloats(float[] floats, int offset, int len)Reads a specified number of floats into an array at the specified offset.
| name | type | description |
|---|---|---|
| floats | float[] | the array to read bytes into |
| offset | int | the offset in the array to start storing floats |
| len | int | the number of floats to read |
readGroupVInt(int[] dst, int offset)GroupVIntUtil#readGroupVInts(DataInput, int[], int) to decode a full group including tails
instead.
Legacy: This method allowed to implement GroupVInt encoding in a more efficient way when this implementation supports random access. It is no longer called by Lucene's code.
If you have implemented this method, simply remove it!
readInts(int[] dst, int offset, int length)Reads a specified number of ints into an array at the specified offset.
| name | type | description |
|---|---|---|
| dst | int[] | the array to read bytes into |
| offset | int | the offset in the array to start storing ints |
| length | int | the number of ints to read |
readMapOfStrings()Reads a Map<String,String> previously written with DataOutput#writeMapOfStrings(Map).
Returns: An immutable map containing the written contents.
readSetOfStrings()Reads a Set<String> previously written with DataOutput#writeSetOfStrings(Set).
Returns: An immutable set containing the written contents.
readString()Reads a string.
readVInt()Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers are supported, but should be avoided.
The format is described further in DataOutput#writeVInt(int).
readVLong()Reads a long stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.
The format is described further in DataOutput#writeVInt(int).
readZInt()Read a zig-zag-encoded variable-length
integer.
readZLong()Read a zig-zag-encoded variable-length
integer. Reads between one and ten bytes.
isLoaded() · also: is_loadedReturns a hint whether all the contents of this input are resident in physical memory. It's a hint because the operating system may have paged out some of the data by the time this method returns. If the optional is true, then it's likely that the contents of this input are resident in physical memory. A value of false does not imply that the contents are not resident in physical memory. An empty optional is returned if it is not possible to determine.
This runs in linear time with the #length() of this input / page size.
The default implementation returns an empty optional.
prefetch(long offset, long length)Optional method: Give a hint to this input that some bytes will be read in the near future. IndexInput implementations may take advantage of this hint to start fetching pages of data immediately from storage.
The default implementation is a no-op.
| name | type | description |
|---|---|---|
| offset | long | start offset |
| length | long | the number of bytes to prefetch |
randomAccessSlice(long offset, long length)Creates a random-access slice of this index input, with the given offset and length.
The default implementation calls #slice, and it doesn't support random access, it
implements absolute reads as seek+read.
skipBytes(long numBytes)
Behavior is functionally equivalent to seeking to getFilePointer() + numBytes.
slice(String sliceDescription, long offset, long length, org.apache.lucene.store.IOContext context)Create a slice with a new IOContext. This is typically used by CompoundFormat
implementations to modify the IOContext for specific files within the compound file.
NOTE: only certain IOContext may be usable here, depending on how this
instance was opened.
The default implementation delegates to #slice(String, long, long) and ignores the
IOContext.
toString()updateIOContext(org.apache.lucene.store.IOContext context)Optional method: Updates the IOContext to specify a new read access pattern. IndexInput
implementations may take advantage of this hint to optimize reads from storage.
The default implementation is a no-op.
seek(long pos)
ChecksumIndexInput can only seek forward and seeks are expensive since they imply to
read bytes in-between the current position and the target position in order to update the
checksum.