Top Description Inners Fields Constructors Methods
io.netty5.handler.codec

public Class DefaultHeaders<K, V, T extends Headers<K, V, T>>

extends Object
implements Headers<K, V, T extends Headers<K, V, T>>
Class Inheritance
All Implemented Interfaces
io.netty5.handler.codec.Headers, java.lang.Iterable
Known Direct Subclasses
io.netty5.handler.codec.DefaultHeadersImpl
Type Parameters
<K>
the type of the header name.
<V>
the type of the header value.
<T>
the type to use for return values when the intention is to return this object.
Imports
io.netty5.util.HashingStrategy, java.util.Arrays, .Collections, .Iterator, .LinkedHashSet, .LinkedList, .List, .Map, .Map.Entry, .NoSuchElementException, .Set

Default implementation of Headers;

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
private class
public static interface
private class
public static interface

Field Summary

Modifier and TypeField and Description
private final DefaultHeaders.HeaderEntry<K, V>[]
pack-priv static final int
HASH_CODE_SEED

Constant used to seed the hash code generation.

private final HashingStrategy<K>
private final byte
protected final DefaultHeaders.HeaderEntry<K, V>
private final DefaultHeaders.NameValidator<K>
pack-priv int
private final ValueConverter<V>
private final DefaultHeaders.ValueValidator<V>

Constructor Summary

AccessConstructor and Description
public
DefaultHeaders(ValueConverter<V> valueConverter)

public
DefaultHeaders(ValueConverter<V> valueConverter, DefaultHeaders.NameValidator<K> nameValidator)

public
DefaultHeaders(HashingStrategy<K> nameHashingStrategy, ValueConverter<V> valueConverter)

public
DefaultHeaders(HashingStrategy<K> nameHashingStrategy, ValueConverter<V> valueConverter, DefaultHeaders.NameValidator<K> nameValidator)

public
DefaultHeaders(HashingStrategy<K>
Used to hash and equality compare names.
nameHashingStrategy
,
ValueConverter<V>
Used to convert values to/from native types.
valueConverter
,
DefaultHeaders.NameValidator<K>
Used to validate name elements.
nameValidator
,
int
A hint as to how large the hash data structure should be. The next positive power of two will be used. An upper bound may be enforced.
arraySizeHint
)

Create a new instance.

public
DefaultHeaders(HashingStrategy<K>
Used to hash and equality compare names.
nameHashingStrategy
,
ValueConverter<V>
Used to convert values to/from native types.
valueConverter
,
DefaultHeaders.NameValidator<K>
Used to validate name elements.
nameValidator
,
int
A hint as to how large the hash data structure should be. The next positive power of two will be used. An upper bound may be enforced.
arraySizeHint
,
DefaultHeaders.ValueValidator<V>
The validation strategy for entry values.
valueValidator
)

Create a new instance.

Method Summary

Modifier and TypeMethod and Description
public T
add(K
the name of the header
name
,
V
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.add.

Adds a new header with the specified name and value.
public T
add(K
the header name
name
,
Iterable<? extends V>
the values of the header
values
)

Implements io.netty5.handler.codec.Headers.add, io.netty5.handler.codec.Headers.add.

Adds new headers with the specified name and values.
public T
add(K
the header name
name
,
V...
the values of the header
values
)

Implements io.netty5.handler.codec.Headers.add, io.netty5.handler.codec.Headers.add.

Adds new headers with the specified name and values.
public T
add(Headers<? extends K, ? extends V, ?> headers)

Implements io.netty5.handler.codec.Headers.add.

Adds all header names and values of headers to this object.
private void
add0(int h, int i, K name, V value)

public T
addBoolean(K
the header name
name
,
boolean
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.addBoolean.

Adds a new header.
public T
addByte(K
the header name
name
,
byte
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.addByte.

Adds a new header.
public T
addChar(K
the header name
name
,
char
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.addChar.

Adds a new header.
public T
addDouble(K
the header name
name
,
double
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.addDouble.

Adds a new header.
public T
addFloat(K
the header name
name
,
float
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.addFloat.

Adds a new header.
protected void
addImpl(Headers<? extends K, ? extends V, ?> headers)

public T
addInt(K
the header name
name
,
int
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.addInt.

Adds a new header.
public T
addLong(K
the header name
name
,
long
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.addLong.

Adds a new header.
public T
addObject(K
the header name
name
,
Object
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.addObject.

Adds a new header.
public T
addObject(K
the header name
name
,
Iterable<?>
the value of the header
values
)

Implements io.netty5.handler.codec.Headers.addObject.

Adds a new header with the specified name and values.
public T
addObject(K
the header name
name
,
Object...
the value of the header
values
)

Implements io.netty5.handler.codec.Headers.addObject.

Adds a new header with the specified name and values.
public T
addShort(K
the header name
name
,
short
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.addShort.

Adds a new header.
public T
addTimeMillis(K
the header name
name
,
long
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.addTimeMillis.

Adds a new header.
public T
clear()

Implements io.netty5.handler.codec.Headers.clear.

Removes all headers.
public boolean
contains(K
the header name
name
)

Implements io.netty5.handler.codec.Headers.contains.

Returns true if a header with the name exists, false otherwise.
public boolean
contains(K
the header name
name
,
V
the header value of the header to find
value
)

Implements io.netty5.handler.codec.Headers.contains.

Returns true if a header with the name and value exists, false otherwise.
public final boolean
contains(K name, V value, HashingStrategy<? super V> valueHashingStrategy)

public boolean
containsBoolean(K
the header name
name
,
boolean
the header value
value
)

Implements io.netty5.handler.codec.Headers.containsBoolean.

Returns true if a header with the name and value exists.
public boolean
containsByte(K
the header name
name
,
byte
the header value
value
)

Implements io.netty5.handler.codec.Headers.containsByte.

Returns true if a header with the name and value exists.
public boolean
containsChar(K
the header name
name
,
char
the header value
value
)

Implements io.netty5.handler.codec.Headers.containsChar.

Returns true if a header with the name and value exists.
public boolean
containsDouble(K
the header name
name
,
double
the header value
value
)

Implements io.netty5.handler.codec.Headers.containsDouble.

Returns true if a header with the name and value exists.
public boolean
containsFloat(K
the header name
name
,
float
the header value
value
)

Implements io.netty5.handler.codec.Headers.containsFloat.

Returns true if a header with the name and value exists.
public boolean
containsInt(K
the header name
name
,
int
the header value
value
)

Implements io.netty5.handler.codec.Headers.containsInt.

Returns true if a header with the name and value exists.
public boolean
containsLong(K
the header name
name
,
long
the header value
value
)

Implements io.netty5.handler.codec.Headers.containsLong.

Returns true if a header with the name and value exists.
public boolean
containsObject(K
the header name
name
,
Object
the header value
value
)

Implements io.netty5.handler.codec.Headers.containsObject.

Returns true if a header with the name and value exists.
public boolean
containsShort(K
the header name
name
,
short
the header value
value
)

Implements io.netty5.handler.codec.Headers.containsShort.

Returns true if a header with the name and value exists.
public boolean
containsTimeMillis(K
the header name
name
,
long
the header value
value
)

Implements io.netty5.handler.codec.Headers.containsTimeMillis.

Returns true if a header with the name and value exists.
public DefaultHeaders<K, V, T>
copy()

Returns a deep copy of this instance.

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public final boolean

Returns:

true if this object equals h2 given valueHashingStrategy. false otherwise.
equals
(Headers<K, V, ?>
The object to check equality for.
h2
,
HashingStrategy<V>
Defines how values will be compared for equality.
valueHashingStrategy
)

Test this object for equality against h2.

private V
fromBoolean(K name, boolean value)

private V
fromByte(K name, byte value)

private V
fromChar(K name, char value)

private V
fromDouble(K name, double value)

private V
fromFloat(K name, float value)

private V
fromInt(K name, int value)

private V
fromLong(K name, long value)

private V
fromObject(K name, Object value)

private V
fromShort(K name, short value)

private V
fromTimeMillis(K name, long value)

public V
get(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.get.

Returns the value of a header with the specified name.
public V
get(K
the name of the header to retrieve
name
,
V
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.get.

Returns the value of a header with the specified name.
public List<V>
getAll(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getAll.

Returns all values for the header with the specified name.
public List<V>
getAllAndRemove(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getAllAndRemove.

Returns all values for the header with the specified name and removes them from this object.
public V
getAndRemove(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getAndRemove.

Returns the value of a header with the specified name and removes it from this object.
public V
getAndRemove(K
the name of the header to retrieve
name
,
V
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getAndRemove.

Returns the value of a header with the specified name and removes it from this object.
public Boolean
getBoolean(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getBoolean.

Returns the boolean value of a header with the specified name.
public boolean
getBoolean(K
the name of the header to retrieve
name
,
boolean
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getBoolean.

Returns the boolean value of a header with the specified name.
public Boolean
getBooleanAndRemove(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getBooleanAndRemove.

Returns the boolean value of a header with the specified name and removes the header from this object.
public boolean
getBooleanAndRemove(K
the name of the header to search
name
,
boolean
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getBooleanAndRemove.

Returns the boolean value of a header with the specified name and removes the header from this object.
public Byte
getByte(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getByte.

Returns the byte value of a header with the specified name.
public byte
getByte(K
the name of the header to retrieve
name
,
byte
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getByte.

Returns the byte value of a header with the specified name.
public Byte
getByteAndRemove(K
the name of the header to search
name
)

Implements io.netty5.handler.codec.Headers.getByteAndRemove.

Returns the byte value of a header with the specified name and removes the header from this object.
public byte
getByteAndRemove(K
the name of the header to search
name
,
byte
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getByteAndRemove.

Returns the byte value of a header with the specified name and removes the header from this object.
public Character
getChar(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getChar.

Returns the char value of a header with the specified name.
public char
getChar(K
the name of the header to retrieve
name
,
char
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getChar.

Returns the char value of a header with the specified name.
public Character
getCharAndRemove(K
the name of the header to search
name
)

Implements io.netty5.handler.codec.Headers.getCharAndRemove.

Returns the char value of a header with the specified name and removes the header from this object.
public char
getCharAndRemove(K
the name of the header to search
name
,
char
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getCharAndRemove.

Returns the char value of a header with the specified name and removes the header from this object.
public Double
getDouble(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getDouble.

Returns the double value of a header with the specified name.
public double
getDouble(K
the name of the header to retrieve
name
,
double
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getDouble.

Returns the double value of a header with the specified name.
public Double
getDoubleAndRemove(K
the name of the header to search
name
)

Implements io.netty5.handler.codec.Headers.getDoubleAndRemove.

Returns the double value of a header with the specified name and removes the header from this object.
public double
getDoubleAndRemove(K
the name of the header to search
name
,
double
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getDoubleAndRemove.

Returns the double value of a header with the specified name and removes the header from this object.
public Float
getFloat(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getFloat.

Returns the float value of a header with the specified name.
public float
getFloat(K
the name of the header to retrieve
name
,
float
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getFloat.

Returns the float value of a header with the specified name.
public Float
getFloatAndRemove(K
the name of the header to search
name
)

Implements io.netty5.handler.codec.Headers.getFloatAndRemove.

Returns the float value of a header with the specified name and removes the header from this object.
public float
getFloatAndRemove(K
the name of the header to search
name
,
float
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getFloatAndRemove.

Returns the float value of a header with the specified name and removes the header from this object.
public Integer
getInt(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getInt.

Returns the int value of a header with the specified name.
public int
getInt(K
the name of the header to retrieve
name
,
int
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getInt.

Returns the int value of a header with the specified name.
public Integer
getIntAndRemove(K
the name of the header to search
name
)

Implements io.netty5.handler.codec.Headers.getIntAndRemove.

Returns the int value of a header with the specified name and removes the header from this object.
public int
getIntAndRemove(K
the name of the header to search
name
,
int
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getIntAndRemove.

Returns the int value of a header with the specified name and removes the header from this object.
public Long
getLong(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getLong.

Returns the long value of a header with the specified name.
public long
getLong(K
the name of the header to retrieve
name
,
long
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getLong.

Returns the long value of a header with the specified name.
public Long
getLongAndRemove(K
the name of the header to search
name
)

Implements io.netty5.handler.codec.Headers.getLongAndRemove.

Returns the long value of a header with the specified name and removes the header from this object.
public long
getLongAndRemove(K
the name of the header to search
name
,
long
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getLongAndRemove.

Returns the long value of a header with the specified name and removes the header from this object.
public Short
getShort(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getShort.

Returns the short value of a header with the specified name.
public short
getShort(K
the name of the header to retrieve
name
,
short
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getShort.

Returns the short value of a header with the specified name.
public Short
getShortAndRemove(K
the name of the header to search
name
)

Implements io.netty5.handler.codec.Headers.getShortAndRemove.

Returns the short value of a header with the specified name and removes the header from this object.
public short
getShortAndRemove(K
the name of the header to search
name
,
short
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getShortAndRemove.

Returns the short value of a header with the specified name and removes the header from this object.
public Long
getTimeMillis(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getTimeMillis.

Returns the value of a header with the specified name in milliseconds.
public long
getTimeMillis(K
the name of the header to retrieve
name
,
long
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getTimeMillis.

Returns the value of a header with the specified name in milliseconds.
public Long
getTimeMillisAndRemove(K
the name of the header to retrieve
name
)

Implements io.netty5.handler.codec.Headers.getTimeMillisAndRemove.

Returns the value of a header with the specified name in milliseconds and removes the header from this object.
public long
getTimeMillisAndRemove(K
the name of the header to retrieve
name
,
long
the default value
defaultValue
)

Implements io.netty5.handler.codec.Headers.getTimeMillisAndRemove.

Returns the value of a header with the specified name in milliseconds and removes the header from this object.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public final int
hashCode(HashingStrategy<V>
Defines how values will be hashed.
valueHashingStrategy
)

Generate a hash code for this object given a HashingStrategy to generate hash codes for individual values.

private int
index(int hash)

public boolean
isEmpty()

Implements io.netty5.handler.codec.Headers.isEmpty.

Returns true if size() equals 0.
public Iterator<Map.Entry<K, V>>
iterator()

Implements io.netty5.handler.codec.Headers.iterator.

Returns an iterator over elements of type T.
public Set<K>
names()

Implements io.netty5.handler.codec.Headers.names.

Returns a Set of all header names in this object.
protected DefaultHeaders.NameValidator<K>
protected DefaultHeaders.HeaderEntry<K, V>
newHeaderEntry(int h, K name, V value, DefaultHeaders.HeaderEntry<K, V> next)

public boolean
remove(K
the header name
name
)

Implements io.netty5.handler.codec.Headers.remove.

Removes all headers with the specified name.
private V

Returns:

the first value inserted whose hash code equals h and whose name is equal to name.
remove0
(int h, int i, K name)

pack-priv DefaultHeaders.HeaderEntry<K, V>
public T
set(K
the header name
name
,
V
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.set.

Sets a header with the specified name and value.
public T
set(K
the header name
name
,
Iterable<? extends V>
the value of the header
values
)

Implements io.netty5.handler.codec.Headers.set, io.netty5.handler.codec.Headers.set.

Sets a new header with the specified name and values.
public T
set(K
the header name
name
,
V...
the value of the header
values
)

Implements io.netty5.handler.codec.Headers.set, io.netty5.handler.codec.Headers.set.

Sets a header with the specified name and values.
public T
set(Headers<? extends K, ? extends V, ?> headers)

Implements io.netty5.handler.codec.Headers.set.

Clears the current header entries and copies all header entries of the specified headers.
public T
setAll(Headers<? extends K, ? extends V, ?>
The headers used to set(K, V) values in this instance
headers
)

Implements io.netty5.handler.codec.Headers.setAll.

Retains all current headers but calls set(K, V) for each entry in headers.
public T
setBoolean(K
The name to modify
name
,
boolean
The value
value
)

Implements io.netty5.handler.codec.Headers.setBoolean.

Set the name to value.
public T
setByte(K
The name to modify
name
,
byte
The value
value
)

Implements io.netty5.handler.codec.Headers.setByte.

Set the name to value.
public T
setChar(K
The name to modify
name
,
char
The value
value
)

Implements io.netty5.handler.codec.Headers.setChar.

Set the name to value.
public T
setDouble(K
The name to modify
name
,
double
The value
value
)

Implements io.netty5.handler.codec.Headers.setDouble.

Set the name to value.
public T
setFloat(K
The name to modify
name
,
float
The value
value
)

Implements io.netty5.handler.codec.Headers.setFloat.

Set the name to value.
public T
setInt(K
The name to modify
name
,
int
The value
value
)

Implements io.netty5.handler.codec.Headers.setInt.

Set the name to value.
public T
setLong(K
The name to modify
name
,
long
The value
value
)

Implements io.netty5.handler.codec.Headers.setLong.

Set the name to value.
public T
setObject(K
the header name
name
,
Object
the value of the header
value
)

Implements io.netty5.handler.codec.Headers.setObject.

Sets a new header.
public T
setObject(K
the header name
name
,
Iterable<?>
the values of the header
values
)

Implements io.netty5.handler.codec.Headers.setObject.

Sets a header with the specified name and values.
public T
setObject(K
the header name
name
,
Object...
the values of the header
values
)

Implements io.netty5.handler.codec.Headers.setObject.

Sets a header with the specified name and values.
public T
setShort(K
The name to modify
name
,
short
The value
value
)

Implements io.netty5.handler.codec.Headers.setShort.

Set the name to value.
public T
setTimeMillis(K
The name to modify
name
,
long
The value
value
)

Implements io.netty5.handler.codec.Headers.setTimeMillis.

Set the name to value.
public int
size()

Implements io.netty5.handler.codec.Headers.size.

Returns the number of headers in this object.
private T
private boolean
toBoolean(K name, V value)

private byte
toByte(K name, V value)

private char
toChar(K name, V value)

private double
toDouble(K name, V value)

private float
toFloat(K name, V value)

private int
toInt(K name, V value)

private long
toLong(K name, V value)

private short
toShort(K name, V value)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
private long
toTimeMillis(K name, V value)

protected void
validateName(DefaultHeaders.NameValidator<K>
the validator to use
validator
,
boolean
true if this validation is for adding to the headers, or false if this is for setting (overwriting) the given header.
forAdd
,
K
the name to validate.
name
)

Call out to the given NameValidator to validate the given name.

protected void
validateValue(DefaultHeaders.ValueValidator<V> validator, K name, V value)

protected ValueConverter<V>
public Iterator<V>

Returns:

an Iterator of header values corresponding to name.
valueIterator
(K
the name of the header to retrieve
name
)

Equivalent to getAll(Object) but no intermediate list is generated.

protected DefaultHeaders.ValueValidator<V>
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait