Top Description Inners Fields Constructors Methods
io.netty.handler.codec.http2

public final Class ReadOnlyHttp2Headers

extends Object
implements Http2Headers
Class Inheritance
All Implemented Interfaces
io.netty.handler.codec.http2.Http2Headers, io.netty.handler.codec.Headers, java.lang.Iterable
Imports
io.netty.handler.codec.Headers, io.netty.util.AsciiString, .HashingStrategy, java.util.ArrayList, .Collections, .Iterator, .LinkedHashSet, .List, .Map, .NoSuchElementException, .Set

A variant of Http2Headers which only supports read-only methods.

Any array passed to this class may be used directly in the underlying data structures of this class. If these arrays may be modified it is the caller's responsibility to supply this class with a copy of the array.

This may be a good alternative to DefaultHttp2Headers if your have a fixed set of headers which will not change.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class

Field Summary

Modifier and TypeField and Description
private final AsciiString[]
private static final byte
private final AsciiString[]

Constructor Summary

AccessConstructor and Description
private
ReadOnlyHttp2Headers(boolean validateHeaders, AsciiString[] pseudoHeaders, AsciiString... otherHeaders)

Method Summary

Modifier and TypeMethod and Description
public Http2Headers
add(CharSequence
the name of the header
name
,
CharSequence
the value of the header
value
)

Implements io.netty.handler.codec.Headers.add.

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

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

Adds new headers with the specified name and values.
public Http2Headers
add(CharSequence
the header name
name
,
CharSequence...
the values of the header
values
)

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

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

Implements io.netty.handler.codec.Headers.add.

Adds all header names and values of headers to this object.
public Http2Headers
addBoolean(CharSequence
the header name
name
,
boolean
the value of the header
value
)

Implements io.netty.handler.codec.Headers.addBoolean.

Adds a new header.
public Http2Headers
addByte(CharSequence
the header name
name
,
byte
the value of the header
value
)

Implements io.netty.handler.codec.Headers.addByte.

Adds a new header.
public Http2Headers
addChar(CharSequence
the header name
name
,
char
the value of the header
value
)

Implements io.netty.handler.codec.Headers.addChar.

Adds a new header.
public Http2Headers
addDouble(CharSequence
the header name
name
,
double
the value of the header
value
)

Implements io.netty.handler.codec.Headers.addDouble.

Adds a new header.
public Http2Headers
addFloat(CharSequence
the header name
name
,
float
the value of the header
value
)

Implements io.netty.handler.codec.Headers.addFloat.

Adds a new header.
public Http2Headers
addInt(CharSequence
the header name
name
,
int
the value of the header
value
)

Implements io.netty.handler.codec.Headers.addInt.

Adds a new header.
public Http2Headers
addLong(CharSequence
the header name
name
,
long
the value of the header
value
)

Implements io.netty.handler.codec.Headers.addLong.

Adds a new header.
public Http2Headers
addObject(CharSequence
the header name
name
,
Object
the value of the header
value
)

Implements io.netty.handler.codec.Headers.addObject.

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

Implements io.netty.handler.codec.Headers.addObject.

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

Implements io.netty.handler.codec.Headers.addObject.

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

Implements io.netty.handler.codec.Headers.addShort.

Adds a new header.
public Http2Headers
addTimeMillis(CharSequence
the header name
name
,
long
the value of the header
value
)

Implements io.netty.handler.codec.Headers.addTimeMillis.

Adds a new header.
public Http2Headers
public CharSequence
authority()

Implements io.netty.handler.codec.http2.Http2Headers.authority.

Gets the PseudoHeaderName#AUTHORITY header or null if there is no such header
public Http2Headers
clear()

Implements io.netty.handler.codec.Headers.clear.

Removes all headers.
public static ReadOnlyHttp2Headers

Returns:

a new read only representation of headers used by clients.
clientHeaders
(boolean
true will run validation on each header name/value pair to ensure protocol compliance.
validateHeaders
,
AsciiString method, AsciiString
The value for PseudoHeaderName#PATH.
path
,
AsciiString scheme, AsciiString authority, AsciiString...
An array of key:value pairs. Must not contain any pseudo headers or null names/values. A copy will NOT be made of this array. If the contents of this array may be modified externally you are responsible for passing in a copy.
otherHeaders
)

Create a new read only representation of headers used by clients.

public boolean
contains(CharSequence
the header name
name
)

Implements io.netty.handler.codec.Headers.contains.

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

Implements io.netty.handler.codec.Headers.contains.

Returns true if a header with the name and value exists, false otherwise.
public boolean
contains(CharSequence
the name of the header to find
name
,
CharSequence
the value of the header to find
value
,
boolean
true then a case insensitive compare is run to compare values. otherwise a case sensitive compare is run to compare values.
caseInsensitive
)

Implements io.netty.handler.codec.http2.Http2Headers.contains.

Returns true if a header with the name and value exists, false otherwise.
private static boolean
contains(CharSequence name, int nameHash, CharSequence value, int valueHash, HashingStrategy<CharSequence> hashingStrategy, AsciiString[] headers)

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

Implements io.netty.handler.codec.Headers.containsBoolean.

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

Implements io.netty.handler.codec.Headers.containsByte.

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

Implements io.netty.handler.codec.Headers.containsChar.

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

Implements io.netty.handler.codec.Headers.containsDouble.

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

Implements io.netty.handler.codec.Headers.containsFloat.

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

Implements io.netty.handler.codec.Headers.containsInt.

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

Implements io.netty.handler.codec.Headers.containsLong.

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

Implements io.netty.handler.codec.Headers.containsObject.

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

Implements io.netty.handler.codec.Headers.containsShort.

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

Implements io.netty.handler.codec.Headers.containsTimeMillis.

Returns true if a header with the name and value exists.
public CharSequence
get(CharSequence
the name of the header to retrieve
name
)

Implements io.netty.handler.codec.Headers.get.

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

Implements io.netty.handler.codec.Headers.get.

Returns the value of a header with the specified name.
private AsciiString
public List<CharSequence>
getAll(CharSequence
the name of the header to retrieve
name
)

Implements io.netty.handler.codec.Headers.getAll.

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

Implements io.netty.handler.codec.Headers.getAllAndRemove.

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

Implements io.netty.handler.codec.Headers.getAndRemove.

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

Implements io.netty.handler.codec.Headers.getAndRemove.

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

Implements io.netty.handler.codec.Headers.getBoolean.

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

Implements io.netty.handler.codec.Headers.getBoolean.

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

Implements io.netty.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(CharSequence
the name of the header to search
name
,
boolean
the default value
defaultValue
)

Implements io.netty.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(CharSequence
the name of the header to retrieve
name
)

Implements io.netty.handler.codec.Headers.getByte.

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

Implements io.netty.handler.codec.Headers.getByte.

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

Implements io.netty.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(CharSequence
the name of the header to search
name
,
byte
the default value
defaultValue
)

Implements io.netty.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(CharSequence
the name of the header to retrieve
name
)

Implements io.netty.handler.codec.Headers.getChar.

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

Implements io.netty.handler.codec.Headers.getChar.

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

Implements io.netty.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(CharSequence
the name of the header to search
name
,
char
the default value
defaultValue
)

Implements io.netty.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(CharSequence
the name of the header to retrieve
name
)

Implements io.netty.handler.codec.Headers.getDouble.

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

Implements io.netty.handler.codec.Headers.getDouble.

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

Implements io.netty.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(CharSequence
the name of the header to search
name
,
double
the default value
defaultValue
)

Implements io.netty.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(CharSequence
the name of the header to retrieve
name
)

Implements io.netty.handler.codec.Headers.getFloat.

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

Implements io.netty.handler.codec.Headers.getFloat.

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

Implements io.netty.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(CharSequence
the name of the header to search
name
,
float
the default value
defaultValue
)

Implements io.netty.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(CharSequence
the name of the header to retrieve
name
)

Implements io.netty.handler.codec.Headers.getInt.

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

Implements io.netty.handler.codec.Headers.getInt.

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

Implements io.netty.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(CharSequence
the name of the header to search
name
,
int
the default value
defaultValue
)

Implements io.netty.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(CharSequence
the name of the header to retrieve
name
)

Implements io.netty.handler.codec.Headers.getLong.

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

Implements io.netty.handler.codec.Headers.getLong.

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

Implements io.netty.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(CharSequence
the name of the header to search
name
,
long
the default value
defaultValue
)

Implements io.netty.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(CharSequence
the name of the header to retrieve
name
)

Implements io.netty.handler.codec.Headers.getShort.

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

Implements io.netty.handler.codec.Headers.getShort.

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

Implements io.netty.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(CharSequence
the name of the header to search
name
,
short
the default value
defaultValue
)

Implements io.netty.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(CharSequence
the name of the header to retrieve
name
)

Implements io.netty.handler.codec.Headers.getTimeMillis.

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

Implements io.netty.handler.codec.Headers.getTimeMillis.

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

Implements io.netty.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(CharSequence
the name of the header to retrieve
name
,
long
the default value
defaultValue
)

Implements io.netty.handler.codec.Headers.getTimeMillisAndRemove.

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

Implements io.netty.handler.codec.Headers.isEmpty.

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

Implements io.netty.handler.codec.http2.Http2Headers.iterator.

Returns an iterator over all HTTP/2 headers.
public Http2Headers
public CharSequence
method()

Implements io.netty.handler.codec.http2.Http2Headers.method.

Gets the PseudoHeaderName#METHOD header or null if there is no such header
public Set<CharSequence>
names()

Implements io.netty.handler.codec.Headers.names.

Returns a Set of all header names in this object.
private static IllegalArgumentException
public Http2Headers
public CharSequence
path()

Implements io.netty.handler.codec.http2.Http2Headers.path.

Gets the PseudoHeaderName#PATH header or null if there is no such header
public boolean
remove(CharSequence
the header name
name
)

Implements io.netty.handler.codec.Headers.remove.

Removes all headers with the specified name.
public Http2Headers
public CharSequence
scheme()

Implements io.netty.handler.codec.http2.Http2Headers.scheme.

Gets the PseudoHeaderName#SCHEME header or null if there is no such header
public static ReadOnlyHttp2Headers

Returns:

a new read only representation of headers used by servers.
serverHeaders
(boolean
true will run validation on each header name/value pair to ensure protocol compliance.
validateHeaders
,
AsciiString status, AsciiString...
An array of key:value pairs. Must not contain any pseudo headers or null names/values. A copy will NOT be made of this array. If the contents of this array may be modified externally you are responsible for passing in a copy.
otherHeaders
)

Create a new read only representation of headers used by servers.

public Http2Headers
set(CharSequence
the header name
name
,
CharSequence
the value of the header
value
)

Implements io.netty.handler.codec.Headers.set.

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

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

Sets a new header with the specified name and values.
public Http2Headers
set(CharSequence
the header name
name
,
CharSequence...
the value of the header
values
)

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

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

Implements io.netty.handler.codec.Headers.set.

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

Implements io.netty.handler.codec.Headers.setAll.

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

Implements io.netty.handler.codec.Headers.setBoolean.

Set the name to value.
public Http2Headers
setByte(CharSequence
The name to modify
name
,
byte
The value
value
)

Implements io.netty.handler.codec.Headers.setByte.

Set the name to value.
public Http2Headers
setChar(CharSequence
The name to modify
name
,
char
The value
value
)

Implements io.netty.handler.codec.Headers.setChar.

Set the name to value.
public Http2Headers
setDouble(CharSequence
The name to modify
name
,
double
The value
value
)

Implements io.netty.handler.codec.Headers.setDouble.

Set the name to value.
public Http2Headers
setFloat(CharSequence
The name to modify
name
,
float
The value
value
)

Implements io.netty.handler.codec.Headers.setFloat.

Set the name to value.
public Http2Headers
setInt(CharSequence
The name to modify
name
,
int
The value
value
)

Implements io.netty.handler.codec.Headers.setInt.

Set the name to value.
public Http2Headers
setLong(CharSequence
The name to modify
name
,
long
The value
value
)

Implements io.netty.handler.codec.Headers.setLong.

Set the name to value.
public Http2Headers
setObject(CharSequence
the header name
name
,
Object
the value of the header
value
)

Implements io.netty.handler.codec.Headers.setObject.

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

Implements io.netty.handler.codec.Headers.setObject.

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

Implements io.netty.handler.codec.Headers.setObject.

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

Implements io.netty.handler.codec.Headers.setShort.

Set the name to value.
public Http2Headers
setTimeMillis(CharSequence
The name to modify
name
,
long
The value
value
)

Implements io.netty.handler.codec.Headers.setTimeMillis.

Set the name to value.
public int
size()

Implements io.netty.handler.codec.Headers.size.

Returns the number of headers in this object.
public Http2Headers
public CharSequence
status()

Implements io.netty.handler.codec.http2.Http2Headers.status.

Gets the PseudoHeaderName#STATUS header or null if there is no such header
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public static ReadOnlyHttp2Headers

Returns:

A read only representation of the headers.
trailers
(boolean
true will run validation on each header name/value pair to ensure protocol compliance.
validateHeaders
,
AsciiString...
An array of key:value pairs. Must not contain any pseudo headers or null names/values. A copy will NOT be made of this array. If the contents of this array may be modified externally you are responsible for passing in a copy.
otherHeaders
)

Used to create read only object designed to represent trailers.

private static void
validateHeaders(AsciiString[] pseudoHeaders, AsciiString... otherHeaders)

public Iterator<CharSequence>
valueIterator(CharSequence
the name of the header to retrieve
name
)

Implements io.netty.handler.codec.http2.Http2Headers.valueIterator.

Equivalent to getAll(Object) but no intermediate list is generated.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait