public interface Headers<T> extends Iterable<Map.Entry<T,T>>
Modifier and Type | Interface and Description |
---|---|
static interface |
Headers.EntryVisitor<T>
A visitor that helps reduce GC pressure while iterating over a collection of
Headers . |
static interface |
Headers.NameVisitor<T>
A visitor that helps reduce GC pressure while iterating over a collection of
Headers . |
static interface |
Headers.ValueConverter<T>
Converts to/from a generic object to the type of the name for this map
|
Modifier and Type | Method and Description |
---|---|
Headers<T> |
add(Headers<T> headers)
Adds all header entries of the specified
headers . |
Headers<T> |
add(T name,
Iterable<? extends T> values)
Adds a new header with the specified name and values.
|
Headers<T> |
add(T name,
T... values)
Adds a new header with the specified name and values.
|
Headers<T> |
add(T name,
T value)
Adds a new header with the specified name and value.
|
Headers<T> |
addBoolean(T name,
boolean value)
Add the
name to value . |
Headers<T> |
addByte(T name,
byte value)
Add the
name to value . |
Headers<T> |
addChar(T name,
char value)
Add the
name to value . |
Headers<T> |
addDouble(T name,
double value)
Add the
name to value . |
Headers<T> |
addFloat(T name,
float value)
Add the
name to value . |
Headers<T> |
addInt(T name,
int value)
Add the
name to value . |
Headers<T> |
addLong(T name,
long value)
Add the
name to value . |
Headers<T> |
addObject(T name,
Iterable<?> values)
Adds a new header with the specified name and values.
|
Headers<T> |
addObject(T name,
Object... values)
Adds a new header with the specified name and values.
|
Headers<T> |
addObject(T name,
Object value)
Adds a new header with the specified name and value.
|
Headers<T> |
addShort(T name,
short value)
Add the
name to value . |
Headers<T> |
addTimeMillis(T name,
long value)
Add the
name to value . |
Headers<T> |
clear()
Removes all headers.
|
boolean |
contains(T name)
Returns
true if and only if this collection contains the header with the specified name. |
boolean |
contains(T name,
T value)
Returns
true if a header with the name and value exists. |
boolean |
contains(T name,
T value,
Comparator<? super T> comparator)
Returns
true if a header with the name and value exists. |
boolean |
contains(T name,
T value,
Comparator<? super T> keyComparator,
Comparator<? super T> valueComparator)
Returns
true if a header with the name and value exists. |
boolean |
containsBoolean(T name,
boolean value)
Returns
true if a header with the name and value exists. |
boolean |
containsByte(T name,
byte value)
Returns
true if a header with the name and value exists. |
boolean |
containsChar(T name,
char value)
Returns
true if a header with the name and value exists. |
boolean |
containsDouble(T name,
double value)
Returns
true if a header with the name and value exists. |
boolean |
containsFloat(T name,
float value)
Returns
true if a header with the name and value exists. |
boolean |
containsInt(T name,
int value)
Returns
true if a header with the name and value exists. |
boolean |
containsLong(T name,
long value)
Returns
true if a header with the name and value exists. |
boolean |
containsObject(T name,
Object value)
Returns
true if a header with the name and value exists. |
boolean |
containsObject(T name,
Object value,
Comparator<? super T> comparator)
Returns
true if a header with the name and value exists. |
boolean |
containsObject(T name,
Object value,
Comparator<? super T> keyComparator,
Comparator<? super T> valueComparator)
Returns
true if a header with the name and value exists. |
boolean |
containsShort(T name,
short value)
Returns
true if a header with the name and value exists. |
boolean |
containsTimeMillis(T name,
long value)
Returns
true if a header with the name and value exists. |
List<Map.Entry<T,T>> |
entries()
Returns a new
List that contains all headers in this object. |
Map.Entry<T,T> |
forEachEntry(Headers.EntryVisitor<T> visitor)
Provide a means of iterating over elements in this map with low GC
|
T |
forEachName(Headers.NameVisitor<T> visitor)
Provide a means of iterating over elements in this map with low GC
|
T |
get(T name)
Returns the value of a header with the specified name.
|
T |
get(T name,
T defaultValue)
Returns the value of a header with the specified name.
|
List<T> |
getAll(T name)
Returns the values of headers with the specified name
|
List<T> |
getAllAndRemove(T name)
Returns and Removes the values of headers with the specified name
|
T |
getAndRemove(T name)
Returns and removes the value of a header with the specified name.
|
T |
getAndRemove(T name,
T defaultValue)
Returns and removes the value of a header with the specified name.
|
Boolean |
getBoolean(T name)
Returns the boolean value of a header with the specified name.
|
boolean |
getBoolean(T name,
boolean defaultValue)
Returns the boolean value of a header with the specified name.
|
Boolean |
getBooleanAndRemove(T name)
Returns and removes the boolean value of a header with the specified name.
|
boolean |
getBooleanAndRemove(T name,
boolean defaultValue)
Returns and removes the boolean value of a header with the specified name.
|
Byte |
getByte(T name)
Returns the byte value of a header with the specified name.
|
byte |
getByte(T name,
byte defaultValue)
Returns the byte value of a header with the specified name.
|
Byte |
getByteAndRemove(T name)
Returns and removes the byte value of a header with the specified name.
|
byte |
getByteAndRemove(T name,
byte defaultValue)
Returns and removes the byte value of a header with the specified name.
|
Character |
getChar(T name)
Returns the char value of a header with the specified name.
|
char |
getChar(T name,
char defaultValue)
Returns the char value of a header with the specified name.
|
Character |
getCharAndRemove(T name)
Returns and removes the char value of a header with the specified name.
|
char |
getCharAndRemove(T name,
char defaultValue)
Returns and removes the char value of a header with the specified name.
|
Double |
getDouble(T name)
Returns the double value of a header with the specified name.
|
double |
getDouble(T name,
double defaultValue)
Returns the double value of a header with the specified name.
|
Double |
getDoubleAndRemove(T name)
Returns and removes the double value of a header with the specified name.
|
double |
getDoubleAndRemove(T name,
double defaultValue)
Returns and removes the double value of a header with the specified name.
|
Float |
getFloat(T name)
Returns the float value of a header with the specified name.
|
float |
getFloat(T name,
float defaultValue)
Returns the float value of a header with the specified name.
|
Float |
getFloatAndRemove(T name)
Returns and removes the float value of a header with the specified name.
|
float |
getFloatAndRemove(T name,
float defaultValue)
Returns and removes the float value of a header with the specified name.
|
Integer |
getInt(T name)
Returns the integer value of a header with the specified name.
|
int |
getInt(T name,
int defaultValue)
Returns the integer value of a header with the specified name.
|
short |
getInt(T name,
short defaultValue)
Returns the short value of a header with the specified name.
|
Integer |
getIntAndRemove(T name)
Returns and removes the integer value of a header with the specified name.
|
int |
getIntAndRemove(T name,
int defaultValue)
Returns and removes the integer value of a header with the specified name.
|
Long |
getLong(T name)
Returns the long value of a header with the specified name.
|
long |
getLong(T name,
long defaultValue)
Returns the long value of a header with the specified name.
|
Long |
getLongAndRemove(T name)
Returns and removes the long value of a header with the specified name.
|
long |
getLongAndRemove(T name,
long defaultValue)
Returns and removes the long value of a header with the specified name.
|
Short |
getShort(T name)
Returns the short value of a header with the specified name.
|
Short |
getShortAndRemove(T name)
Returns and removes the short value of a header with the specified name.
|
short |
getShortAndRemove(T name,
short defaultValue)
Returns and removes the short value of a header with the specified name.
|
Long |
getTimeMillis(T name)
Returns the date value of a header with the specified name as milliseconds.
|
long |
getTimeMillis(T name,
long defaultValue)
Returns the date value of a header with the specified name as milliseconds.
|
Long |
getTimeMillisAndRemove(T name)
Returns and removes the date value of a header with the specified name as milliseconds.
|
long |
getTimeMillisAndRemove(T name,
long defaultValue)
Returns and removes the date value of a header with the specified name as milliseconds.
|
boolean |
isEmpty()
Returns
true if and only if this collection contains no header entries. |
Iterator<Map.Entry<T,T>> |
iterator() |
Set<T> |
names()
Returns a new
Set that contains the names of all headers in this object. |
List<T> |
namesList()
Returns a new
List that contains the names of all headers in this object. |
boolean |
remove(T name)
Removes the header with the specified name.
|
Headers<T> |
set(Headers<T> headers)
Cleans the current header entries and copies all header entries of the specified
headers . |
Headers<T> |
set(T name,
Iterable<? extends T> values)
Sets a header with the specified name and values.
|
Headers<T> |
set(T name,
T... values)
Sets a header with the specified name and values.
|
Headers<T> |
set(T name,
T value)
Sets a header with the specified name and value.
|
Headers<T> |
setAll(Headers<T> headers)
Retains all current headers but calls
set(Object, Object) for each entry in headers |
Headers<T> |
setBoolean(T name,
boolean value)
Set the
name to value . |
Headers<T> |
setByte(T name,
byte value)
Set the
name to value . |
Headers<T> |
setChar(T name,
char value)
Set the
name to value . |
Headers<T> |
setDouble(T name,
double value)
Set the
name to value . |
Headers<T> |
setFloat(T name,
float value)
Set the
name to value . |
Headers<T> |
setInt(T name,
int value)
Set the
name to value . |
Headers<T> |
setLong(T name,
long value)
Set the
name to value . |
Headers<T> |
setObject(T name,
Iterable<?> values)
Sets a header with the specified name and values.
|
Headers<T> |
setObject(T name,
Object... values)
Sets a header with the specified name and values.
|
Headers<T> |
setObject(T name,
Object value)
Sets a header with the specified name and value.
|
Headers<T> |
setShort(T name,
short value)
Set the
name to value . |
Headers<T> |
setTimeMillis(T name,
long value)
Set the
name to value . |
int |
size()
Returns the number of header entries in this collection.
|
T get(T name)
name
- the name of the header to searchnull
if there's no such header.T get(T name, T defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there's no such header.T getAndRemove(T name)
name
- the name of the header to searchnull
if there is no such headerT getAndRemove(T name, T defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there is no such headerList<T> getAll(T name)
name
- The name of the headers to searchList
of header values which will be empty if no values are foundList<T> getAllAndRemove(T name)
name
- The name of the headers to searchList
of header values which will be empty if no values are foundBoolean getBoolean(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a boolean.boolean getBoolean(T name, boolean defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there's
no such header or its value is not a boolean.Byte getByte(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a byte.byte getByte(T name, byte defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there's no
such header or its value is not a byte.Character getChar(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a char.char getChar(T name, char defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there's no
such header or its value is not a char.Short getShort(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a short.short getInt(T name, short defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there's
no such header or its value is not a short.Integer getInt(T name)
name
- the name of the header to searchnull
if there's no
such header or its value is not an integer.int getInt(T name, int defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if
there's no such header or its value is not an integer.Long getLong(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a long.long getLong(T name, long defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there's no
such header or its value is not a long.Float getFloat(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a float.float getFloat(T name, float defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there's
no such header or its value is not a float.Double getDouble(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a double.double getDouble(T name, double defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there's
no such header or its value is not a double.Long getTimeMillis(T name)
name
- The name of the header to searchnull
if
there's no such header or its value is not a date.long getTimeMillis(T name, long defaultValue)
name
- The name of the header to searchdefaultValue
- default valuedefaultValue
if there's no such header or its value is not a date.Boolean getBooleanAndRemove(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a boolean.boolean getBooleanAndRemove(T name, boolean defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there
is no such header or its value of header is not a boolean.Byte getByteAndRemove(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a byte.byte getByteAndRemove(T name, byte defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there is
no such header or its value of header is not a byte.Character getCharAndRemove(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a char.char getCharAndRemove(T name, char defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there is
no such header or its value of header is not a char.Short getShortAndRemove(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a short.short getShortAndRemove(T name, short defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there is
no such header or its value of header is not a short.Integer getIntAndRemove(T name)
name
- the name of the header to searchnull
if there's no
such header or its value is not an integer.int getIntAndRemove(T name, int defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there
is no such header or its value of header is not an integer.Long getLongAndRemove(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a long.long getLongAndRemove(T name, long defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there's no
such header or its value is not a long.Float getFloatAndRemove(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a float.float getFloatAndRemove(T name, float defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there's
no such header or its value is not a float.Double getDoubleAndRemove(T name)
name
- the name of the header to searchnull
if there's no such
header or its value is not a double.double getDoubleAndRemove(T name, double defaultValue)
name
- the name of the header to searchdefaultValue
- the default valuedefaultValue
if there's
no such header or its value is not a double.Long getTimeMillisAndRemove(T name)
name
- The name of the header to searchnull
if
there's no such header or its value is not a date.long getTimeMillisAndRemove(T name, long defaultValue)
name
- The name of the header to searchdefaultValue
- default valuedefaultValue
if there's no such header or its value is not a date.List<Map.Entry<T,T>> entries()
List
that contains all headers in this object. Note that modifying the returned
List
will not affect the state of this object. If you intend to enumerate over the header entries only,
use iterator()
instead, which has much less overhead.boolean contains(T name)
true
if and only if this collection contains the header with the specified name.name
- The name of the header to search fortrue
if at least one header is foundboolean contains(T name, T value)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuetrue
if it contains it false
otherwiseboolean containsObject(T name, Object value)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuetrue
if it contains it false
otherwiseboolean containsBoolean(T name, boolean value)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuetrue
if it contains it false
otherwiseboolean containsByte(T name, byte value)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuetrue
if it contains it false
otherwiseboolean containsChar(T name, char value)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuetrue
if it contains it false
otherwiseboolean containsShort(T name, short value)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuetrue
if it contains it false
otherwiseboolean containsInt(T name, int value)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuetrue
if it contains it false
otherwiseboolean containsLong(T name, long value)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuetrue
if it contains it false
otherwiseboolean containsFloat(T name, float value)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuetrue
if it contains it false
otherwiseboolean containsDouble(T name, double value)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuetrue
if it contains it false
otherwiseboolean containsTimeMillis(T name, long value)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuetrue
if it contains it false
otherwiseboolean contains(T name, T value, Comparator<? super T> comparator)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuecomparator
- The comparator to use when comparing name
and value
to entries in this maptrue
if it contains it false
otherwiseboolean contains(T name, T value, Comparator<? super T> keyComparator, Comparator<? super T> valueComparator)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuekeyComparator
- The comparator to use when comparing name
to names in this mapvalueComparator
- The comparator to use when comparing value
to values in this maptrue
if it contains it false
otherwiseboolean containsObject(T name, Object value, Comparator<? super T> comparator)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuecomparator
- The comparator to use when comparing name
and value
to entries in this maptrue
if it contains it false
otherwiseboolean containsObject(T name, Object value, Comparator<? super T> keyComparator, Comparator<? super T> valueComparator)
true
if a header with the name and value exists.name
- the header namevalue
- the header valuekeyComparator
- The comparator to use when comparing name
to names in this mapvalueComparator
- The comparator to use when comparing value
to values in this maptrue
if it contains it false
otherwiseint size()
boolean isEmpty()
true
if and only if this collection contains no header entries.Set<T> names()
Set
that contains the names of all headers in this object. Note that modifying the returned
Set
will not affect the state of this object. If you intend to enumerate over the header entries only,
use iterator()
instead, which has much less overhead.List<T> namesList()
List
that contains the names of all headers in this object. Note that modifying the
returned List
will not affect the state of this object. If you intend to enumerate over the header
entries only, use iterator()
instead, which has much less overhead.Headers<T> add(T name, T value)
String
, it is
converted into a String
by Object.toString()
, except in the cases of Date
and
Calendar
, which are formatted to the date format defined in RFC2616.name
- the name of the header being addedvalue
- the value of the header being addedthis
Headers<T> add(T name, Iterable<? extends T> values)
for (Object v : values) { if (v == null) { break; } headers.add(name, v); }
name
- the name of the headepublic abstract rs being setvalues
- the values of the headers being setthis
Headers<T> add(T name, T... values)
for (Object v : values) { if (v == null) { break; } headers.add(name, v); }
name
- the name of the headepublic abstract rs being setvalues
- the values of the headers being setthis
Headers<T> addObject(T name, Object value)
String
, it is
converted into a String
by Object.toString()
, except in the cases of Date
and
Calendar
, which are formatted to the date format defined in RFC2616.name
- the name of the header being addedvalue
- the value of the header being addedthis
Headers<T> addObject(T name, Iterable<?> values)
for (Object v : values) { if (v == null) { break; } headers.add(name, v); }
name
- the name of the headepublic abstract rs being setvalues
- the values of the headers being setthis
Headers<T> addObject(T name, Object... values)
for (Object v : values) { if (v == null) { break; } headers.add(name, v); }
name
- the name of the headepublic abstract rs being setvalues
- the values of the headers being setthis
Headers<T> addBoolean(T name, boolean value)
name
to value
.name
- The name to modifyvalue
- The valuethis
Headers<T> addByte(T name, byte value)
name
to value
.name
- The name to modifyvalue
- The valuethis
Headers<T> addChar(T name, char value)
name
to value
.name
- The name to modifyvalue
- The valuethis
Headers<T> addShort(T name, short value)
name
to value
.name
- The name to modifyvalue
- The valuethis
Headers<T> addInt(T name, int value)
name
to value
.name
- The name to modifyvalue
- The valuethis
Headers<T> addLong(T name, long value)
name
to value
.name
- The name to modifyvalue
- The valuethis
Headers<T> addFloat(T name, float value)
name
to value
.name
- The name to modifyvalue
- The valuethis
Headers<T> addDouble(T name, double value)
name
to value
.name
- The name to modifyvalue
- The valuethis
Headers<T> addTimeMillis(T name, long value)
name
to value
.name
- The name to modifyvalue
- The valuethis
Headers<T> add(Headers<T> headers)
headers
.this
Headers<T> set(T name, T value)
String
, it is converted into a String
by
Object.toString()
, except for Date
and Calendar
, which are formatted
to the date format defined in RFC2616.name
- The name of the header being setvalue
- The value of the header being setthis
Headers<T> set(T name, Iterable<? extends T> values)
headers.remove(name); for (Object v : values) { if (v == null) { break; } headers.add(name, v); }
name
- the name of the headers being setvalues
- the values of the headers being setthis
Headers<T> set(T name, T... values)
headers.remove(name); for (Object v : values) { if (v == null) { break; } headers.add(name, v); }
name
- the name of the headers being setvalues
- the values of the headers being setthis
Headers<T> setObject(T name, Object value)
String
, it is converted into a String
by
Object.toString()
, except for Date
and Calendar
, which are formatted
to the date format defined in RFC2616.name
- The name of the header being setvalue
- The value of the header being setthis
Headers<T> setObject(T name, Iterable<?> values)
headers.remove(name); for (Object v : values) { if (v == null) { break; } headers.add(name, v); }
name
- the name of the headers being setvalues
- the values of the headers being setthis
Headers<T> setObject(T name, Object... values)
headers.remove(name); for (Object v : values) { if (v == null) { break; } headers.add(name, v); }
name
- the name of the headers being setvalues
- the values of the headers being setthis
Headers<T> setBoolean(T name, boolean value)
name
to value
. This will remove all previous values associated with name
.name
- The name to modifyvalue
- The valuethis
Headers<T> setByte(T name, byte value)
name
to value
. This will remove all previous values associated with name
.name
- The name to modifyvalue
- The valuethis
Headers<T> setChar(T name, char value)
name
to value
. This will remove all previous values associated with name
.name
- The name to modifyvalue
- The valuethis
Headers<T> setShort(T name, short value)
name
to value
. This will remove all previous values associated with name
.name
- The name to modifyvalue
- The valuethis
Headers<T> setInt(T name, int value)
name
to value
. This will remove all previous values associated with name
.name
- The name to modifyvalue
- The valuethis
Headers<T> setLong(T name, long value)
name
to value
. This will remove all previous values associated with name
.name
- The name to modifyvalue
- The valuethis
Headers<T> setFloat(T name, float value)
name
to value
. This will remove all previous values associated with name
.name
- The name to modifyvalue
- The valuethis
Headers<T> setDouble(T name, double value)
name
to value
. This will remove all previous values associated with name
.name
- The name to modifyvalue
- The valuethis
Headers<T> setTimeMillis(T name, long value)
name
to value
. This will remove all previous values associated with name
.name
- The name to modifyvalue
- The valuethis
Headers<T> set(Headers<T> headers)
headers
.this
Headers<T> setAll(Headers<T> headers)
set(Object, Object)
for each entry in headers
headers
- The headers used to set(Object, Object)
values in this instancethis
boolean remove(T name)
name
- The name of the header to removetrue
if and only if at least one entry has been removedMap.Entry<T,T> forEachEntry(Headers.EntryVisitor<T> visitor) throws Exception
visitor
- The visitor which will visit each element in this mapnull
if iteration went past the endException
T forEachName(Headers.NameVisitor<T> visitor) throws Exception
visitor
- The visitor which will visit each element in this mapnull
if iteration went past the endException
Copyright © 2008–2015 The Netty Project. All rights reserved.