Udostępnij za pośrednictwem


ResponseCache.Put(URI, URLConnection) Method

Definition

The protocol handler calls this method after a resource has been retrieved, and the ResponseCache must decide whether or not to store the resource in its cache.

[Android.Runtime.Register("put", "(Ljava/net/URI;Ljava/net/URLConnection;)Ljava/net/CacheRequest;", "GetPut_Ljava_net_URI_Ljava_net_URLConnection_Handler")]
public abstract Java.Net.CacheRequest? Put (Java.Net.URI? uri, Java.Net.URLConnection? conn);
[<Android.Runtime.Register("put", "(Ljava/net/URI;Ljava/net/URLConnection;)Ljava/net/CacheRequest;", "GetPut_Ljava_net_URI_Ljava_net_URLConnection_Handler")>]
abstract member Put : Java.Net.URI * Java.Net.URLConnection -> Java.Net.CacheRequest

Parameters

uri
URI

a URI used to reference the requested network resource

conn
URLConnection
  • a URLConnection instance that is used to fetch the response to be cached

Returns

a CacheRequest for recording the response to be cached. Null return indicates that the caller does not intend to cache the response.

Attributes

Exceptions

if an I/O error occurs while adding the resource.

if any one of the parameters is set to null.

Remarks

The protocol handler calls this method after a resource has been retrieved, and the ResponseCache must decide whether or not to store the resource in its cache. If the resource is to be cached, then put() must return a CacheRequest object which contains an OutputStream that the protocol handler will use to write the resource into the cache. If the resource is not to be cached, then put must return null.

Java documentation for java.net.ResponseCache.put(java.net.URI, java.net.URLConnection).

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