Package org.apache.lucene.store
Class ByteBuffersDataInput
java.lang.Object
org.apache.lucene.store.DataInput
org.apache.lucene.store.ByteBuffersDataInput
- All Implemented Interfaces:
Cloneable,RandomAccessInput,Accountable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final intprivate final ByteBuffer[]private final longprivate longprivate final longFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
ConstructorsConstructorDescriptionByteBuffersDataInput(List<ByteBuffer> buffers) Read data from a set of contiguous buffers. -
Method Summary
Modifier and TypeMethodDescriptionprivate final intblockIndex(long pos) private final intblockOffset(long pos) private int(package private) static intdetermineBlockPage(List<ByteBuffer> buffers) private static voidensureAssumptions(List<ByteBuffer> buffers) private static final booleanisPowerOfTwo(int v) longposition()longReturn the memory usage of this object in bytes.bytereadByte()Reads and returns a single byte.bytereadByte(long pos) Reads a byte at the given position in the filevoidreadBytes(byte[] arr, int off, int len) Reads a specified number of bytes into an array at the specified offset.voidreadBytes(ByteBuffer buffer, int len) Reads exactlylenbytes into the given buffer.intreadInt(long pos) Reads an integer at the given position in the filelongreadLong(long pos) Reads a long at the given position in the fileshortreadShort(long pos) Reads a short at the given position in the filevoidseek(long position) longsize()slice(long offset, long length) private static List<ByteBuffer> sliceBufferList(List<ByteBuffer> buffers, long offset, long length) toString()Methods inherited from class org.apache.lucene.store.DataInput
clone, readBytes, readInt, readLELongs, readLong, readMapOfStrings, readSetOfStrings, readShort, readString, readVInt, readVLong, readZInt, readZLong, skipBytesMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Field Details
-
blocks
-
blockBits
private final int blockBits -
blockMask
private final int blockMask -
size
private final long size -
offset
private final long offset -
pos
private long pos
-
-
Constructor Details
-
ByteBuffersDataInput
Read data from a set of contiguous buffers. All data buffers except for the last one must have an identical remaining number of bytes in the buffer (that is a power of two). The last buffer can be of an arbitrary remaining length.
-
-
Method Details
-
size
public long size() -
ramBytesUsed
public long ramBytesUsed()Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsedin interfaceAccountable
-
readByte
Description copied from class:DataInputReads and returns a single byte.- Specified by:
readBytein classDataInput- Throws:
EOFException- See Also:
-
readBytes
Reads exactlylenbytes into the given buffer. The buffer must have enough remaining limit. If there are fewer thanlenbytes in the input,EOFExceptionis thrown.- Throws:
EOFException
-
readBytes
Description copied from class:DataInputReads a specified number of bytes into an array at the specified offset.- Specified by:
readBytesin classDataInput- Parameters:
arr- the array to read bytes intooff- the offset in the array to start storing byteslen- the number of bytes to read- Throws:
EOFException- See Also:
-
readByte
public byte readByte(long pos) Description copied from interface:RandomAccessInputReads a byte at the given position in the file- Specified by:
readBytein interfaceRandomAccessInput- See Also:
-
readShort
public short readShort(long pos) Description copied from interface:RandomAccessInputReads a short at the given position in the file- Specified by:
readShortin interfaceRandomAccessInput- See Also:
-
readInt
public int readInt(long pos) Description copied from interface:RandomAccessInputReads an integer at the given position in the file- Specified by:
readIntin interfaceRandomAccessInput- See Also:
-
readLong
public long readLong(long pos) Description copied from interface:RandomAccessInputReads a long at the given position in the file- Specified by:
readLongin interfaceRandomAccessInput- See Also:
-
position
public long position() -
seek
- Throws:
EOFException
-
slice
-
toString
-
blockIndex
private final int blockIndex(long pos) -
blockOffset
private final int blockOffset(long pos) -
blockSize
private int blockSize() -
isPowerOfTwo
private static final boolean isPowerOfTwo(int v) -
ensureAssumptions
-
determineBlockPage
-
sliceBufferList
-