Package io.grpc
Interface HasByteBuffer
-
public interface HasByteBufferExtension to anInputStreamwhose content can be accessed asByteBuffers.This can be used for optimizing the case for the consumer of a
ByteBuffer-backed input stream supports efficient reading fromByteBuffers directly. This turns the reader interface from anInputStreamtoByteBuffers, without copying the content to a byte array and read from it.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanbyteBufferSupported()Indicates whether or notgetByteBuffer()operation is supported.ByteBuffergetByteBuffer()Gets aByteBuffercontaining some bytes of the content next to be read, ornullif has reached end of the content.
-
-
-
Method Detail
-
byteBufferSupported
boolean byteBufferSupported()
Indicates whether or notgetByteBuffer()operation is supported.
-
getByteBuffer
@Nullable ByteBuffer getByteBuffer()
Gets aByteBuffercontaining some bytes of the content next to be read, ornullif has reached end of the content. The number of bytes contained in the returned buffer is implementation specific. Calling this method does not change the position of the input stream. The returned buffer's content should not be modified, but the position, limit, and mark may be changed. Operations for changing the position, limit, and mark of the returned buffer does not affect the position, limit, and mark of this input stream. This is an optional method, so callers should first checkbyteBufferSupported().- Throws:
UnsupportedOperationException- if this operation is not supported.
-
-