public final class HeaderList extends java.lang.Object implements java.lang.Iterable<HeaderList.Entry>
A combination of name-value must be unique.
Names are compared case-insensitive.
All name characters must be within u0021 .. u007e (inclusive)
All value characters must either be \t or within u0020 .. u007e (inclusive)
Created by covers1624 on 1/8/23.
| Modifier and Type | Class and Description |
|---|---|
static class |
HeaderList.Entry |
| Constructor and Description |
|---|
HeaderList() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.lang.String name,
java.lang.String value)
Adds name-value pair.
|
void |
addAll(HeaderList other)
Add all the entries form the specified
HeaderList to
this collection. |
void |
addAll(java.util.Map<java.lang.String,java.lang.String> entries)
Add all the entries from the specified
Map to
this collection. |
void |
addAllMulti(java.util.Map<java.lang.String,java.util.List<java.lang.String>> entries)
Add all the entries from the specified
Map to
this collection. |
void |
addFirst(java.lang.String name,
java.lang.String value)
Adds name-value pair.
|
void |
clear()
Delete all headers in this list.
|
boolean |
contains(java.lang.String name,
java.lang.String value)
Checks if this collection contains the given name-value pair.
|
@Nullable java.lang.String |
get(java.lang.String name)
Get the first value with the specified name.
|
java.util.List<java.lang.String> |
getValues(java.lang.String name)
Get all values with the specified name.
|
boolean |
isEmpty()
Checks if the collection is empty.
|
java.util.Iterator<HeaderList.Entry> |
iterator() |
void |
removeAll(java.lang.String name)
Remove all entries with the specified name.
|
void |
set(java.lang.String name,
java.lang.String value)
Remove all existing values of a specified name, then insert a new value.
|
int |
size()
Gets the number of entries in the collection.
|
java.lang.String[] |
toStrings()
Convert this header list into a list of assembled header strings.
|
public boolean isEmpty()
public int size()
public void add(java.lang.String name,
java.lang.String value)
name - The name.value - The value.public void addFirst(java.lang.String name,
java.lang.String value)
name - The name.value - The value.public void addAll(java.util.Map<java.lang.String,java.lang.String> entries)
Map to
this collection.entries - The entries to add.public void addAllMulti(java.util.Map<java.lang.String,java.util.List<java.lang.String>> entries)
Map to
this collection.entries - The entries to add.public void addAll(HeaderList other)
HeaderList to
this collection.other - The entries to add.public void set(java.lang.String name,
java.lang.String value)
name - The name.value - The value.public boolean contains(java.lang.String name,
java.lang.String value)
name - The name.value - The value.public void removeAll(java.lang.String name)
name - The name to remove.@Nullable public @Nullable java.lang.String get(java.lang.String name)
name - The name to get the first value for.null if it does not exist.public java.util.List<java.lang.String> getValues(java.lang.String name)
name - The name to get values for.public void clear()
public java.lang.String[] toStrings()
For example HeaderName: HeaderValue
public java.util.Iterator<HeaderList.Entry> iterator()
iterator in interface java.lang.Iterable<HeaderList.Entry>