public final class ByteBuffersDataInput extends DataInput implements Accountable, RandomAccessInput
NULL_ACCOUNTABLE
Constructor and Description |
---|
ByteBuffersDataInput(List<ByteBuffer> buffers)
Read data from a set of contiguous buffers.
|
Modifier and Type | Method and Description |
---|---|
long |
position() |
long |
ramBytesUsed()
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 file
|
void |
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 exactly
len bytes into the given buffer. |
int |
readInt(long pos)
Reads an integer at the given position in the file
|
long |
readLong(long pos)
Reads a long at the given position in the file
|
short |
readShort(long pos)
Reads a short at the given position in the file
|
void |
seek(long position) |
long |
size() |
ByteBuffersDataInput |
slice(long offset,
long length) |
String |
toString() |
clone, readBytes, readInt, readLELongs, readLong, readMapOfStrings, readSetOfStrings, readShort, readString, readVInt, readVLong, readZInt, readZLong, skipBytes
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getChildResources
public ByteBuffersDataInput(List<ByteBuffer> buffers)
public long size()
public long ramBytesUsed()
Accountable
ramBytesUsed
in interface Accountable
public byte readByte() throws EOFException
DataInput
readByte
in class DataInput
EOFException
DataOutput.writeByte(byte)
public void readBytes(ByteBuffer buffer, int len) throws EOFException
len
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.EOFException
public void readBytes(byte[] arr, int off, int len) throws EOFException
DataInput
readBytes
in class DataInput
arr
- the array to read bytes intooff
- the offset in the array to start storing byteslen
- the number of bytes to readEOFException
DataOutput.writeBytes(byte[],int)
public byte readByte(long pos)
RandomAccessInput
readByte
in interface RandomAccessInput
DataInput.readByte()
public short readShort(long pos)
RandomAccessInput
readShort
in interface RandomAccessInput
DataInput.readShort()
public int readInt(long pos)
RandomAccessInput
readInt
in interface RandomAccessInput
DataInput.readInt()
public long readLong(long pos)
RandomAccessInput
readLong
in interface RandomAccessInput
DataInput.readLong()
public long position()
public void seek(long position) throws EOFException
EOFException
public ByteBuffersDataInput slice(long offset, long length)
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.