語言

HttpURLConnection.SetChunkedStreamingMode(Int32) 方法

定義

此方法用於在內容長度為 <b>not</b> 事先已知時,實現 HTTP 請求實體的串流,無需內部緩衝。

[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

參數

chunklen
Int32

每個區塊要寫入的位元組數。 若 chunklen 小於或等於零,則會使用預設值。

屬性

例外狀況

如果已經連線或其他模式已設定。

備註

此方法用於在內容長度為 <b>not</b> 事先已知時,實現 HTTP 請求實體的串流,無需內部緩衝。 在此模式下,使用分塊傳輸編碼來傳送請求主體。 注意,並非所有 HTTP 伺服器都支援此模式。

當輸出串流啟用時,認證與重定向無法自動處理。 若需要驗證或重定向,讀取回應時會拋出 HttpRetryException。 此例外可被查詢錯誤細節。

此方法必須在 URLConnection 連接前被呼叫。

已在1.5中新增。

Java 文件 java.net.HttpURLConnection.setChunkedStreamingMode(int)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於

另請參閱