다음을 통해 공유


URLConnection.Content Property

Definition

Retrieves the contents of this URL connection.

public virtual Java.Lang.Object? Content { [Android.Runtime.Register("getContent", "()Ljava/lang/Object;", "GetGetContentHandler")] get; }
[<get: Android.Runtime.Register("getContent", "()Ljava/lang/Object;", "GetGetContentHandler")>]
member this.Content : Java.Lang.Object

Property Value

the object fetched. The instanceof operator should be used to determine the specific kind of object returned.

Attributes

Exceptions

if an error occurs obtaining the content.

Remarks

Retrieves the contents of this URL connection.

This method first determines the content type of the object by calling the getContentType method. If this is the first time that the application has seen that specific content type, a content handler for that content type is created: <ol> <li>If the application has set up a content handler factory instance using the setContentHandlerFactory method, the createContentHandler method of that instance is called with the content type as an argument; the result is a content handler for that content type. <li>If no content handler factory has yet been set up, or if the factory's createContentHandler method returns null, then the application loads the class named: <blockquote>

sun.net.www.content.&lt;<i>contentType</i>&gt;

</blockquote> where &lt;contentType&gt; is formed by taking the content-type string, replacing all slash characters with a period ('.'), and all other non-alphanumeric characters with the underscore character '_'. The alphanumeric characters are specifically the 26 uppercase ASCII letters 'A' through 'Z', the 26 lowercase ASCII letters 'a' through 'z', and the 10 ASCII digits '0' through '9'. If the specified class does not exist, or is not a subclass of ContentHandler, then an UnknownServiceException is thrown. </ol>

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

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