Stay organized with collections
Save and categorize content based on your preferences.
CacheResponse
abstract class CacheResponse
Known Direct Subclasses
SecureCacheResponse |
Represents a cache response originally retrieved through secure means, such as TLS.
|
|
Represent channels for retrieving resources from the ResponseCache. Instances of such a class provide an InputStream that returns the entity body, and also a getHeaders() method which returns the associated response headers.
Summary
Public constructors
CacheResponse
CacheResponse()
Public methods
getBody
abstract fun getBody(): InputStream!
Returns the response body as an InputStream.
Return |
InputStream! |
an InputStream from which the response body can be accessed |
Exceptions |
java.io.IOException |
if an I/O error occurs while getting the response body |
abstract fun getHeaders(): MutableMap<String!, MutableList<String!>!>!
Returns the response headers as a Map.
Return |
MutableMap<String!, MutableList<String!>!>! |
An immutable Map from response header field names to lists of field values. The status line has null as its field name. |
Exceptions |
java.io.IOException |
if an I/O error occurs while getting the response headers |
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,["# CacheResponse\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nCacheResponse\n=============\n\n```\nabstract class CacheResponse\n```\n\n|---|-----------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [java.net.CacheResponse](#) |\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [SecureCacheResponse](/reference/kotlin/java/net/SecureCacheResponse) |-----------------------------------------------------------------------|-------------------------------------------------------------------------------------| | [SecureCacheResponse](/reference/kotlin/java/net/SecureCacheResponse) | Represents a cache response originally retrieved through secure means, such as TLS. | |\n\nRepresent channels for retrieving resources from the ResponseCache. Instances of such a class provide an InputStream that returns the entity body, and also a getHeaders() method which returns the associated response headers.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------|---|\n| [CacheResponse](#CacheResponse())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|\n| abstract [InputStream](../io/InputStream.html#)! | [getBody](#getBody())`()` Returns the response body as an InputStream. |\n| abstract [MutableMap](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html)\\\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!, [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\\\u003e!\\\u003e! | [getHeaders](#getHeaders())`()` Returns the response headers as a Map. |\n\nPublic constructors\n-------------------\n\n### CacheResponse\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nCacheResponse()\n```\n\nPublic methods\n--------------\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(): InputStream!\n```\n\nReturns the response body as an InputStream.\n\n| Return ||\n|-----------------------------------------|-------------------------------------------------------------|\n| [InputStream](../io/InputStream.html#)! | an InputStream from which the response body can be accessed |\n\n| Exceptions ||\n|-----------------------|--------------------------------------------------------|\n| `java.io.IOException` | if an I/O error occurs while getting the response body |\n\n### getHeaders\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getHeaders(): MutableMap\u003cString!, MutableList\u003cString!\u003e!\u003e!\n```\n\nReturns the response headers as a Map.\n\n| Return ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|\n| [MutableMap](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html)\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!,` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\u003e!\u003e! | An immutable Map from response header field names to lists of field values. The status line has null as its field name. |\n\n| Exceptions ||\n|-----------------------|-----------------------------------------------------------|\n| `java.io.IOException` | if an I/O error occurs while getting the response headers |"]]