Stay organized with collections
Save and categorize content based on your preferences.
CacheRequest
abstract class CacheRequest
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 Unit |
Aborts the attempt to cache the response.
|
abstract OutputStream! |
Returns an OutputStream to which the response body can be written.
|
Public constructors
CacheRequest
CacheRequest()
Public methods
abort
abstract fun abort(): Unit
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
abstract fun getBody(): OutputStream!
Returns an OutputStream to which the response body can be written.
Return |
OutputStream! |
an OutputStream to which the response body can be written |
Exceptions |
java.io.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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# CacheRequest\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nCacheRequest\n============\n\n```\nabstract class CacheRequest\n```\n\n|---|----------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [java.net.CacheRequest](#) |\n\nRepresents 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.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------|---|\n| [CacheRequest](#CacheRequest())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [abort](#abort())`()` Aborts the attempt to cache the response. |\n| abstract [OutputStream](../io/OutputStream.html#)! | [getBody](#getBody())`()` Returns an OutputStream to which the response body can be written. |\n\nPublic constructors\n-------------------\n\n### CacheRequest\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nCacheRequest()\n```\n\nPublic methods\n--------------\n\n### abort\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun abort(): Unit\n```\n\nAborts 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. \n\n### getBody\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getBody(): OutputStream!\n```\n\nReturns an OutputStream to which the response body can be written.\n\n| Return ||\n|-------------------------------------------|-----------------------------------------------------------|\n| [OutputStream](../io/OutputStream.html#)! | an OutputStream to which the response body can be written |\n\n| Exceptions ||\n|-----------------------|--------------------------------------------------------|\n| `java.io.IOException` | if an I/O error occurs while writing the response body |"]]