Header

接口扩展了MutableMap和Copyable

,用于管理Message请求或响应的头部信息 它提供了一种链式调用的方式来设置和获取头部字段,同时也支持将头部信息设置为只读状态

Properties

Link copied to clipboard
Link copied to clipboard
abstract val isReadOnly: Boolean

表示当前Header实例是否为只读状态 当isReadOnlytrue时,Header的内容不能被修改

Link copied to clipboard
abstract override val keys: MutableSet<String>
Link copied to clipboard
abstract val size: Int
Link copied to clipboard
abstract override val values: MutableCollection<String>

Functions

Link copied to clipboard
abstract fun clear()
Link copied to clipboard
abstract fun containsKey(key: String): Boolean
Link copied to clipboard
abstract fun containsValue(value: String): Boolean
Link copied to clipboard
abstract fun copy(): Header

复制当前对象 该方法用于创建并返回当前对象的一个复制品,确保复制品在修改时不会影响到原始对象

Link copied to clipboard
abstract operator fun get(key: String): String?
Link copied to clipboard
abstract fun isEmpty(): Boolean
Link copied to clipboard
abstract fun put(key: String, value: String): String?
Link copied to clipboard
abstract fun putAll(from: Map<out String, String>)
Link copied to clipboard
open fun with(additional: Map<String, String>): Header

在当前Header实例中添加一系列键值对,并返回当前实例以支持链式调用

open fun with(key: String, value: String): Header

在当前Header实例中添加一个键值对,并返回当前实例以支持链式调用

Link copied to clipboard
abstract fun withReadOnly(): Header

创建一个新的Header实例,其内容与当前实例相同,但设置为只读状态