다음을 통해 공유


HttpURLConnection.SetChunkedStreamingMode(Int32) Method

Definition

This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is <b>not</b> known in advance.

[Android.Runtime.Register("setChunkedStreamingMode", "(I)V", "GetSetChunkedStreamingMode_IHandler")]
public virtual void SetChunkedStreamingMode (int chunklen);
[<Android.Runtime.Register("setChunkedStreamingMode", "(I)V", "GetSetChunkedStreamingMode_IHandler")>]
abstract member SetChunkedStreamingMode : int -> unit
override this.SetChunkedStreamingMode : int -> unit

Parameters

chunklen
Int32

The number of bytes to write in each chunk. If chunklen is less than or equal to zero, a default value will be used.

Attributes

Exceptions

if already connected or another mode already set.

Remarks

This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is <b>not</b> known in advance. In this mode, chunked transfer encoding is used to send the request body. Note, not all HTTP servers support this mode.

When output streaming is enabled, authentication and redirection cannot be handled automatically. A HttpRetryException will be thrown when reading the response if authentication or redirection are required. This exception can be queried for the details of the error.

This method must be called before the URLConnection is connected.

Added in 1.5.

Java documentation for java.net.HttpURLConnection.setChunkedStreamingMode(int).

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

See also