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
Fields 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 TypeMethodDescriptionlonglength()The number of bytes in the file.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(long pos, byte[] bytes, int offset, int len) Reads a specified number of bytes starting at a given position into an array at the specified offset.voidreadBytes(ByteBuffer buffer, int len) Reads exactlylenbytes into the given buffer.voidreadFloats(float[] arr, int off, int len) Reads a specified number of floats into an array at the specified offset.voidreadGroupVInt(int[] dst, int offset) Override if you have an efficient implementation.intreadInt()Reads four bytes and returns an int (LE byte order).intreadInt(long pos) Reads an integer (LE byte order) at the given position in the filelongreadLong()Reads eight bytes and returns a long (LE byte order).longreadLong(long pos) Reads a long (LE byte order) at the given position in the filevoidreadLongs(long[] arr, int off, int len) Read a specified number of longs.shortReads two bytes and returns a short (LE byte order).shortreadShort(long pos) Reads a short (LE byte order) at the given position in the filevoidseek(long position) voidskipBytes(long numBytes) Skip overnumBytesbytes.slice(long offset, long length) toString()Methods inherited from class org.apache.lucene.store.DataInput
clone, readBytes, readInts, readMapOfStrings, readSetOfStrings, readString, readVInt, readVLong, readZInt, readZLongMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResourcesMethods inherited from interface org.apache.lucene.store.RandomAccessInput
isLoaded, prefetch
-
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
-
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 than
lenbytes 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:
-
readShort
Description copied from class:DataInputReads two bytes and returns a short (LE byte order).- Overrides:
readShortin classDataInput- Throws:
IOException- See Also:
-
readInt
Description copied from class:DataInputReads four bytes and returns an int (LE byte order).- Overrides:
readIntin classDataInput- Throws:
IOException- See Also:
-
readLong
Description copied from class:DataInputReads eight bytes and returns a long (LE byte order).- Overrides:
readLongin classDataInput- Throws:
IOException- See Also:
-
readGroupVInt
Description copied from class:DataInputOverride if you have an efficient implementation. In general this is when the input supports random access.- Overrides:
readGroupVIntin classDataInput- Throws:
IOException
-
length
public long length()Description copied from interface:RandomAccessInputThe number of bytes in the file.- Specified by:
lengthin interfaceRandomAccessInput
-
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:
-
readBytes
Description copied from interface:RandomAccessInputReads a specified number of bytes starting at a given position into an array at the specified offset.- Specified by:
readBytesin interfaceRandomAccessInput- Throws:
IOException- See Also:
-
readShort
public short readShort(long pos) Description copied from interface:RandomAccessInputReads a short (LE byte order) 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 (LE byte order) 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 (LE byte order) at the given position in the file- Specified by:
readLongin interfaceRandomAccessInput- See Also:
-
readFloats
Description copied from class:DataInputReads a specified number of floats into an array at the specified offset.- Overrides:
readFloatsin classDataInput- Parameters:
arr- the array to read bytes intooff- the offset in the array to start storing floatslen- the number of floats to read- Throws:
EOFException
-
readLongs
Description copied from class:DataInputRead a specified number of longs.- Overrides:
readLongsin classDataInput- Throws:
EOFException
-
position
public long position() -
seek
- Throws:
EOFException
-
skipBytes
Description copied from class:DataInputSkip overnumBytesbytes. This method may skip bytes in whatever way is most optimal, and may not have the same behavior as reading the skipped bytes. In general, negativenumBytesare not supported.- Specified by:
skipBytesin classDataInput- Throws:
IOException
-
slice
-
toString
-