@Internal public class ByteBufferReadableClosingFSDataInputStream extends ClosingFSDataInputStream implements ByteBufferReadable
ClosingFSDataInputStream
which is ByteBufferReadable
.Modifier | Constructor and Description |
---|---|
protected |
ByteBufferReadableClosingFSDataInputStream(FSDataInputStream delegate,
SafetyNetCloseableRegistry registry,
String debugInfo) |
Modifier and Type | Method and Description |
---|---|
int |
read(ByteBuffer byteBuffer)
Reads up to byteBuffer.remaining() bytes into byteBuffer.
|
int |
read(long position,
ByteBuffer byteBuffer)
Reads up to
byteBuffer.remaining() bytes into byteBuffer from a given position in the
file and returns the number of bytes read. |
close, equals, hashCode, isClosed, toString, wrapSafe, wrapSafe
available, getPos, getWrappedDelegate, mark, markSupported, read, read, read, reset, seek, skip
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getWrappedDelegate
protected ByteBufferReadableClosingFSDataInputStream(FSDataInputStream delegate, SafetyNetCloseableRegistry registry, String debugInfo) throws IOException
IOException
public int read(ByteBuffer byteBuffer) throws IOException
ByteBufferReadable
After a successful call, byteBuffer.position() will be advanced by the number of bytes read and byteBuffer.limit() should be unchanged.
In the case of an exception, the values of byteBuffer.position() and byteBuffer.limit() are undefined, and callers should be prepared to recover from this eventuality. Implementations should treat 0-length requests as legitimate, and must not signal an error upon their receipt.
read
in interface ByteBufferReadable
byteBuffer
- the ByteBuffer to receive the results of the read operation.IOException
- if there is some error performing the readpublic int read(long position, ByteBuffer byteBuffer) throws IOException
ByteBufferReadable
byteBuffer.remaining()
bytes into byteBuffer from a given position in the
file and returns the number of bytes read. Callers should use byteBuffer.limit(...)
to control the size of the desired read and byteBuffer.position(...)
to control the
offset into the buffer the data should be written to.
After a successful call, byteBuffer.position()
will be advanced by the number of
bytes read and byteBuffer.limit()
will be unchanged.
In the case of an exception, the state of the buffer (the contents of the buffer, the
buf.position()
, the buf.limit()
, etc.) is undefined, and callers should be
prepared to recover from this eventuality.
Implementations should treat 0-length requests as legitimate, and must not signal an error upon their receipt.
read
in interface ByteBufferReadable
position
- position within filebyteBuffer
- the ByteBuffer to receive the results of the read operation.IOException
- if there is some error performing the readCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.