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
ConstructorDescriptionByteBuffersDataInput
(List<ByteBuffer> buffers) Read data from a set of contiguous buffers. -
Method Summary
Modifier and TypeMethodDescriptionlong
position()
long
Return the memory usage of this object in bytes.byte
readByte()
Reads and returns a single byte.byte
readByte
(long pos) Reads a byte at the given position in the filevoid
readBytes
(byte[] arr, int off, int len) Reads a specified number of bytes into an array at the specified offset.void
readBytes
(ByteBuffer buffer, int len) Reads exactlylen
bytes into the given buffer.void
readFloats
(float[] arr, int off, int len) Reads a specified number of floats into an array at the specified offset.int
readInt()
Reads four bytes and returns an int (LE byte order).int
readInt
(long pos) Reads an integer (LE byte order) at the given position in the filelong
readLong()
Reads eight bytes and returns a long (LE byte order).long
readLong
(long pos) Reads a long (LE byte order) at the given position in the filevoid
readLongs
(long[] arr, int off, int len) Read a specified number of longs.short
Reads two bytes and returns a short (LE byte order).short
readShort
(long pos) Reads a short (LE byte order) at the given position in the filevoid
seek
(long position) long
size()
void
skipBytes
(long numBytes) Skip overnumBytes
bytes.slice
(long offset, long length) toString()
Methods inherited from class org.apache.lucene.store.DataInput
clone, readBytes, readMapOfStrings, readSetOfStrings, readString, readVInt, readVLong, readZInt, readZLong
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
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:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsed
in interfaceAccountable
-
readByte
Description copied from class:DataInput
Reads and returns a single byte.- Specified by:
readByte
in classDataInput
- Throws:
EOFException
- See Also:
-
readBytes
Reads exactlylen
bytes into the given buffer. The buffer must have enough remaining limit.If there are fewer than
len
bytes in the input,EOFException
is thrown.- Throws:
EOFException
-
readBytes
Description copied from class:DataInput
Reads a specified number of bytes into an array at the specified offset.- Specified by:
readBytes
in 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:DataInput
Reads two bytes and returns a short (LE byte order).- Overrides:
readShort
in classDataInput
- Throws:
IOException
- See Also:
-
readInt
Description copied from class:DataInput
Reads four bytes and returns an int (LE byte order).- Overrides:
readInt
in classDataInput
- Throws:
IOException
- See Also:
-
readLong
Description copied from class:DataInput
Reads eight bytes and returns a long (LE byte order).- Overrides:
readLong
in classDataInput
- Throws:
IOException
- See Also:
-
readByte
public byte readByte(long pos) Description copied from interface:RandomAccessInput
Reads a byte at the given position in the file- Specified by:
readByte
in interfaceRandomAccessInput
- See Also:
-
readShort
public short readShort(long pos) Description copied from interface:RandomAccessInput
Reads a short (LE byte order) at the given position in the file- Specified by:
readShort
in interfaceRandomAccessInput
- See Also:
-
readInt
public int readInt(long pos) Description copied from interface:RandomAccessInput
Reads an integer (LE byte order) at the given position in the file- Specified by:
readInt
in interfaceRandomAccessInput
- See Also:
-
readLong
public long readLong(long pos) Description copied from interface:RandomAccessInput
Reads a long (LE byte order) at the given position in the file- Specified by:
readLong
in interfaceRandomAccessInput
- See Also:
-
readFloats
Description copied from class:DataInput
Reads a specified number of floats into an array at the specified offset.- Overrides:
readFloats
in 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:DataInput
Read a specified number of longs.- Overrides:
readLongs
in classDataInput
- Throws:
EOFException
-
position
public long position() -
seek
- Throws:
EOFException
-
skipBytes
Description copied from class:DataInput
Skip overnumBytes
bytes. 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, negativenumBytes
are not supported.- Specified by:
skipBytes
in classDataInput
- Throws:
IOException
-
slice
-
toString
-