Class Info |
|---|
public final class Headers 消息头信息。使用Headers.Builder对象的build方法创建Headers对象。 |
Qualifier and Type | Class Name and Description |
|---|---|
public static final class | Headers的构造器。 |
Qualifier and Type | Method Name and Description |
|---|---|
public long | 获取所有消息头数据的字节总长度。 |
public boolean | equals(Object other) 比较other实例是否也为Headers对象,且与当前对象的保存的值相等。 |
public String | get(String name) 获取消息头中指定名称对应的“value”值。 |
public String | name(int index) 获取消息头中对应索引位置的名称。 |
public Set<String> | names() 返回所有消息头的名称。 |
public Headers.Builder | 使用当前对象创建一个包含已有配置信息的、可修改的Builder构造器。 |
public static Headers | of(String... namesAndValues) 将传入的字符串组转化成Headers。 |
public static Headers | of(Map<String, List<String>> headers) 将map形式的消息头信息转化成Headers。 |
public int | size() 获取消息头数量。 |
public Map<String, List<String>> | 返回map形式的消息头信息,区分大小写,例如:“name”和“Name”表示不同值。 |
public String | value(int index) 获取对应索引位置的“value”值。 |
public List<String> | values(String name) 返回指定消息头名称的所有“value”值。 |
Method |
|---|
public long byteCount() 获取所有消息头数据的字节总长度。 |
Returns
Type | Description |
|---|---|
long | 所有消息头数据的字节总长度。 |
Method |
|---|
public boolean equals(Object other) 比较other实例是否也为Headers对象,且与当前对象的保存的值相等。 |
Parameters
Name | Description |
|---|---|
other | 待比较的对象。 |
Returns
Type | Description |
|---|---|
boolean | 待比较对象是否与当前对象相等。
|
Method |
|---|
public String get(String name) 获取消息头中指定名称对应的“value”值。 |
Parameters
Name | Description |
|---|---|
name | 待获取对应“value”值的消息头名称。 |
Returns
Type | Description |
|---|---|
String | 指定消息头名称对应的“value”值。 |
Method |
|---|
public String name(int index) 获取消息头中对应索引位置的的名称。 |
Parameters
Name | Description |
|---|---|
index | 消息头中的索引位置。 |
Returns
Type | Description |
|---|---|
String | 消息头中对应索引位置的名称。 |
Method |
|---|
public Set<String> names() 返回所有消息头的名称。 |
Returns
Type | Description |
|---|---|
Set<String> | 消息头中所有的名称。 |
Method |
|---|
public Headers.Builder newBuilder() 使用当前对象创建一个包含已有配置信息的、可修改的Builder构造器。 |
Returns
Type | Description |
|---|---|
返回创建的包含已有配置信息的、可修改的Builder构造器。 |
Method |
|---|
public static Headers of(String... namesAndValues) 将传入的字符串组转化成Headers。 |
Parameters
Name | Description |
|---|---|
namesAndValues | 待转化的消息头字符串组(多个字符串对象或字符串数组)。字符串组的数量必须为偶数,且信息头的名称和值必须交替,且不含空值,不含换行符。例如:["name1","value1","name2","value2"]。 |
Returns
Type | Description |
|---|---|
Headers | 转化后的Headers实例。 |
Method |
|---|
public static Headers of(Map<String, List<String>> headers) 将map形式的消息头信息转化成Headers。 |
Parameters
Name | Description |
|---|---|
headers | 待转化的消息头信息map。headers对象不可为null,headers中元素不可存在空值(字符串长度为0或对象为空),也不可含有换行符。 |
Returns
Type | Description |
|---|---|
Headers | 转化后的Headers实例。 |
Method |
|---|
public Map<String, List<String>> toMultimap() 返回map形式的消息头信息,区分大小写,例如:“name”和“Name”表示不同值。 |
Returns
Type | Description |
|---|---|
Map<String, List<String>> | 消息头信息的map形式,区分大小写。 |
Method |
|---|
public String value(int index) 获取消息头中对应索引位置的“value”值。 |
Parameters
Name | Description |
|---|---|
index | 消息头中的位置。 |
Returns
Type | Description |
|---|---|
String | 消息头中指定位置的值。 |
Method |
|---|
public List<String> values(String name) 返回指定消息头名称的所有“value”值。 |
Parameters
Name | Description |
|---|---|
name | 待检索的指定消息头名称。 |
Returns
Type | Description |
|---|---|
List<String> | 消息头中指定名字对应的值。 |
// Licensed to the Apache Software Foundation (ASF) under one or morz // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License.