Partager via


BidirectionalStream.Write(ByteBuffer, Boolean) Method

Definition

Attempts to write data from the provided buffer into the stream.

[Android.Runtime.Register("write", "(Ljava/nio/ByteBuffer;Z)V", "GetWrite_Ljava_nio_ByteBuffer_ZHandler", ApiSince=34)]
public abstract void Write (Java.Nio.ByteBuffer buffer, bool endOfStream);
[<Android.Runtime.Register("write", "(Ljava/nio/ByteBuffer;Z)V", "GetWrite_Ljava_nio_ByteBuffer_ZHandler", ApiSince=34)>]
abstract member Write : Java.Nio.ByteBuffer * bool -> unit

Parameters

buffer
ByteBuffer

the ByteBuffer to write data from. 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#onWriteCompleted onWriteCompleted(), Callback#onCanceled onCanceled(), or Callback#onFailed onFailed() are invoked. Can be empty when endOfStream is true.

endOfStream
Boolean

if true, then buffer is the last buffer to be written, and once written, stream is closed from the client side, resulting in half-closed stream or a fully closed stream if the remote side has already closed.

Attributes

Remarks

Attempts to write data from the provided buffer into the stream. If auto flush is disabled, data will be sent only after #flush flush() is called. Each call will result in an invocation of one of the Callback Callback's Callback#onWriteCompleted onWriteCompleted() method if data is sent, or its Callback#onFailed onFailed() method if there's an error.

An attempt to write data from buffer starting at buffer.position() is begun. buffer.remaining() bytes will be written. Callback#onWriteCompleted onWriteCompleted() will be invoked only when the full ByteBuffer is written.

Java documentation for android.net.http.BidirectionalStream.write(java.nio.ByteBuffer, boolean).

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