Stay organized with collections
Save and categorize content based on your preferences.
abstract class HeaderBlock
Unmodifiable container of headers or trailers.
Summary
Public constructors
Public methods
getAsList
abstract fun getAsList(): MutableList<MutableEntry<String!, String!>!>
Returns an unmodifiable list of the header field and value pairs. For response, the headers are in the same order they are received over the wire. For request, the headers are in the same order they are added.
getAsMap
abstract fun getAsMap(): MutableMap<String!, MutableList<String!>!>
Returns an unmodifiable map from header field names to lists of values. Order of each list of values for a single header field is: For response, the same order they were received over the wire. For request, the same order they were added. The iteration order of keys is unspecified.
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,["# HeaderBlock\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [S Extensions 7](https://developer.android.com/sdkExtensions)\n\nHeaderBlock\n===========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/http/HeaderBlock \"View this page in Java\") \n\n```\nabstract class HeaderBlock\n```\n\n|---|-----------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.net.http.HeaderBlock](#) |\n\nUnmodifiable container of headers or trailers.\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------------|---|\n| [HeaderBlock](#HeaderBlock())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|\n| abstract [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[MutableEntry](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/-mutable-entry/index.html)\\\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!, [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\\\u003e!\\\u003e | [getAsList](#getAsList())`()` Returns an unmodifiable list of the header field and value pairs. |\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 | [getAsMap](#getAsMap())`()` Returns an unmodifiable map from header field names to lists of values. |\n\nPublic constructors\n-------------------\n\n### HeaderBlock\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [S Extensions 7](https://developer.android.com/sdkExtensions) \n\n```\nHeaderBlock()\n```\n\nPublic methods\n--------------\n\n### getAsList\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [S Extensions 7](https://developer.android.com/sdkExtensions) \n\n```\nabstract fun getAsList(): MutableList\u003cMutableEntry\u003cString!, String!\u003e!\u003e\n```\n\nReturns an unmodifiable list of the header field and value pairs. For response, the headers are in the same order they are received over the wire. For request, the headers are in the same order they are added.\n\n| Return ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|\n| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[MutableEntry](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/-mutable-entry/index.html)\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!,` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\u003e!\u003e | an unmodifiable list of header field and value pairs This value cannot be `null`. |\n\n### getAsMap\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [S Extensions 7](https://developer.android.com/sdkExtensions) \n\n```\nabstract fun getAsMap(): MutableMap\u003cString!, MutableList\u003cString!\u003e!\u003e\n```\n\nReturns an unmodifiable map from header field names to lists of values. Order of each list of values for a single header field is: For response, the same order they were received over the wire. For request, the same order they were added. The iteration order of keys is unspecified.\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 unmodifiable map from header field names to lists of values This value cannot be `null`. |"]]