Stay organized with collections
Save and categorize content based on your preferences.
CacheRequest
public
abstract
class
CacheRequest
extends Object
Represents channels for storing resources in the
ResponseCache. Instances of such a class provide an
OutputStream object which is called by protocol handlers to
store the resource data into the cache, and also an abort() method
which allows a cache store operation to be interrupted and
abandoned. If an IOException is encountered while reading the
response or writing to the cache, the current cache store operation
will be aborted.
Summary
Public methods |
abstract
void
|
abort()
Aborts the attempt to cache the response.
|
abstract
OutputStream
|
getBody()
Returns an OutputStream to which the response body can be
written.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Public constructors
CacheRequest
public CacheRequest ()
Public methods
abort
public abstract void abort ()
Aborts the attempt to cache the response. If an IOException is
encountered while reading the response or writing to the cache,
the current cache store operation will be abandoned.
getBody
public abstract OutputStream getBody ()
Returns an OutputStream to which the response body can be
written.
Returns |
OutputStream |
an OutputStream to which the response body can
be written |
Throws |
IOException |
if an I/O error occurs while
writing the response body |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# CacheRequest\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Ctors](#pubctors) \\| [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nCacheRequest\n============\n\n\n`\npublic\n\n\nabstract\nclass\nCacheRequest\n`\n\n\n`\n\nextends `[Object](/reference/java/lang/Object)`\n\n\n`\n\n`\n\n\n`\n\n|---|-----------------------|\n| [java.lang.Object](/reference/java/lang/Object) ||\n| ↳ | java.net.CacheRequest |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nRepresents channels for storing resources in the\nResponseCache. Instances of such a class provide an\nOutputStream object which is called by protocol handlers to\nstore the resource data into the cache, and also an abort() method\nwhich allows a cache store operation to be interrupted and\nabandoned. If an IOException is encountered while reading the\nresponse or writing to the cache, the current cache store operation\nwill be aborted.\n\nSummary\n-------\n\n| ### Public constructors ||\n|-------------------------------------------------------------------------|---|\n| ` `[CacheRequest](/reference/java/net/CacheRequest#CacheRequest())`() ` |\n\n| ### Public methods ||\n|-------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[abort](/reference/java/net/CacheRequest#abort())`() ` Aborts the attempt to cache the response. |\n| ` abstract `[OutputStream](/reference/java/io/OutputStream) | ` `[getBody](/reference/java/net/CacheRequest#getBody())`() ` Returns an OutputStream to which the response body can be written. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` `[java.lang.Object](/reference/java/lang/Object)` ` |---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](/reference/java/lang/Object) | ` `[clone](/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object. | | ` boolean` | ` `[equals](/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](/reference/java/lang/Object)` obj) ` Indicates whether some other object is \"equal to\" this one. | | ` void` | ` `[finalize](/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final `[Class](/reference/java/lang/Class)`\u003c?\u003e` | ` `[getClass](/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`. | | ` int` | ` `[hashCode](/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object. | | ` final void` | ` `[notify](/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` `[notifyAll](/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor. | | ` `[String](/reference/java/lang/String) | ` `[toString](/reference/java/lang/Object#toString())`() ` Returns a string representation of the object. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||\n\nPublic constructors\n-------------------\n\n### CacheRequest\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic CacheRequest ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### abort\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void abort ()\n```\n\nAborts the attempt to cache the response. If an IOException is\nencountered while reading the response or writing to the cache,\nthe current cache store operation will be abandoned.\n\n\u003cbr /\u003e\n\n### getBody\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract OutputStream getBody ()\n```\n\nReturns an OutputStream to which the response body can be\nwritten.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------------------------------------------------|------------------------------------------------------------------|\n| [OutputStream](/reference/java/io/OutputStream) | an OutputStream to which the response body can be written \u003cbr /\u003e |\n\n| Throws ||\n|-----------------------------------------------|--------------------------------------------------------|\n| [IOException](/reference/java/io/IOException) | if an I/O error occurs while writing the response body |"]]