共用方式為


URLConnection.ContentLength Property

Definition

Returns the value of the content-length header field.

public virtual int ContentLength { [Android.Runtime.Register("getContentLength", "()I", "GetGetContentLengthHandler")] get; }
[<get: Android.Runtime.Register("getContentLength", "()I", "GetGetContentLengthHandler")>]
member this.ContentLength : int

Property Value

the content length of the resource that this connection's URL references, -1 if the content length is not known, or if the content length is greater than Integer.MAX_VALUE.

Attributes

Remarks

Returns the value of the content-length header field.

<B>Note</B>: #getContentLengthLong() getContentLengthLong() should be preferred over this method, since it returns a long instead and is therefore more portable.

Java documentation for java.net.URLConnection.getContentLength().

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