Share via


UploadDataProvider.Read(UploadDataSink, ByteBuffer) Method

Definition

Reads upload data into byteBuffer.

[Android.Runtime.Register("read", "(Landroid/net/http/UploadDataSink;Ljava/nio/ByteBuffer;)V", "GetRead_Landroid_net_http_UploadDataSink_Ljava_nio_ByteBuffer_Handler", ApiSince=34)]
public abstract void Read (Android.Net.Http.UploadDataSink uploadDataSink, Java.Nio.ByteBuffer byteBuffer);
[<Android.Runtime.Register("read", "(Landroid/net/http/UploadDataSink;Ljava/nio/ByteBuffer;)V", "GetRead_Landroid_net_http_UploadDataSink_Ljava_nio_ByteBuffer_Handler", ApiSince=34)>]
abstract member Read : Android.Net.Http.UploadDataSink * Java.Nio.ByteBuffer -> unit

Parameters

uploadDataSink
UploadDataSink

The object to notify when the read has completed, successfully or otherwise.

byteBuffer
ByteBuffer

The buffer to copy the read bytes into. Do not change byteBuffer's limit.

Attributes

Remarks

Reads upload data into byteBuffer. Upon completion, the buffer's position is updated to the end of the bytes that were read. The buffer's limit is not changed. Each call of this method must be followed be a single call, either synchronous or asynchronous, to uploadDataSink: UploadDataSink#onReadSucceeded on success or UploadDataSink#onReadError on failure. Neither read nor rewind will be called until one of those methods or the other is called. Even if the associated UrlRequest is canceled, one or the other must still be called before resources can be safely freed. Throwing an exception will also result in resources being freed and the request being errored out.

Java documentation for android.net.http.UploadDataProvider.read(android.net.http.UploadDataSink, 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