Share via


BidirectionalStream.Read(ByteBuffer) Method

Definition

Reads data from the stream into the provided buffer.

[Android.Runtime.Register("read", "(Ljava/nio/ByteBuffer;)V", "GetRead_Ljava_nio_ByteBuffer_Handler", ApiSince=34)]
public abstract void Read (Java.Nio.ByteBuffer buffer);
[<Android.Runtime.Register("read", "(Ljava/nio/ByteBuffer;)V", "GetRead_Ljava_nio_ByteBuffer_Handler", ApiSince=34)>]
abstract member Read : Java.Nio.ByteBuffer -> unit

Parameters

buffer
ByteBuffer

the ByteBuffer to read data into. Must be a direct ByteBuffer. The embedder must not read or modify buffer's position, limit, or data between its position and limit until Callback#onReadCompleted onReadCompleted(), Callback#onCanceled onCanceled(), or Callback#onFailed onFailed() are invoked.

Attributes

Remarks

Reads data from the stream into the provided buffer. Can only be called at most once in response to each invocation of the Callback#onStreamReady onStreamReady()/ Callback#onResponseHeadersReceived onResponseHeadersReceived() and Callback#onReadCompleted onReadCompleted() methods of the Callback. Each call will result in an invocation of one of the Callback Callback's Callback#onReadCompleted onReadCompleted() method if data is read, or its Callback#onFailed onFailed() method if there's an error.

An attempt to read data into buffer starting at buffer.position() is begun. At most buffer.remaining() bytes are read. buffer.position() is updated upon invocation of Callback#onReadCompleted onReadCompleted() to indicate how much data was read.

Java documentation for android.net.http.BidirectionalStream.read(java.nio.ByteBuffer).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to