public interface ByteBufferReadable
Modifier and Type | Method and Description |
---|---|
int |
read(ByteBuffer buf)
Reads up to buf.remaining() bytes into buf.
|
int read(ByteBuffer buf) throws IOException
After a successful call, buf.position() will be advanced by the number of bytes read and buf.limit() should be unchanged.
In the case of an exception, the values of buf.position() and buf.limit() are undefined, and callers should be prepared to recover from this eventuality.
Many implementations will throw UnsupportedOperationException
, so
callers that are not confident in support for this method from the
underlying filesystem should be prepared to handle that exception.
Implementations should treat 0-length requests as legitimate, and must not signal an error upon their receipt.
buf
- the ByteBuffer to receive the results of the read operation.IOException
- if there is some error performing the readCopyright © 2016 Apache Software Foundation. All Rights Reserved.