Top Description Methods
io.grpc

public Interface HasByteBuffer

Imports
java.nio.ByteBuffer, javax.annotation.Nullable

Extension to an java.io.InputStream whose content can be accessed as ByteBuffers.

This can be used for optimizing the case for the consumer of a ByteBuffer-backed input stream supports efficient reading from ByteBuffers directly. This turns the reader interface from an java.io.InputStream to ByteBuffers, without copying the content to a byte array and read from it.

Method Summary

Modifier and TypeMethod and Description
public boolean
byteBufferSupported()

Indicates whether or not getByteBuffer operation is supported.

public ByteBuffer
getByteBuffer()

Gets a ByteBuffer containing some bytes of the content next to be read, or null if has reached end of the content.

Method Detail

byteBufferSupportedback to summary
public boolean byteBufferSupported()

Indicates whether or not getByteBuffer operation is supported.

getByteBufferback to summary
public ByteBuffer getByteBuffer()

Gets a ByteBuffer containing some bytes of the content next to be read, or null if 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 check byteBufferSupported.

Annotations
@Nullable
Exceptions
UnsupportedOperationException:
if this operation is not supported.