Package com.linecorp.armeria.common
Interface HttpHeadersBuilder
- All Superinterfaces:
Iterable<Map.Entry<AsciiString,
String>>
- All Known Subinterfaces:
RequestHeadersBuilder
,ResponseHeadersBuilder
public interface HttpHeadersBuilder
Builds an
HttpHeaders
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionadd
(CharSequence name, Iterable<String> values) Adds new headers with the specifiedname
andvalues
.add
(CharSequence name, String value) Adds a new header with the specifiedname
andvalue
.add
(CharSequence name, String... values) Adds new headers with the specifiedname
andvalues
.add
(Iterable<? extends Map.Entry<? extends CharSequence, String>> entries) Adds all header names and values of the specifiedentries
.default HttpHeadersBuilder
add
(Map<? extends CharSequence, String> entries) Adds all header names and values of the specifiedentries
.addDouble
(CharSequence name, double value) Adds a new header.addFloat
(CharSequence name, float value) Adds a new header.addInt
(CharSequence name, int value) Adds a new header.addLong
(CharSequence name, long value) Adds a new header.addObject
(CharSequence name, Iterable<?> values) Adds a new header with the specified name and values.addObject
(CharSequence name, Object value) Adds a new header.addObject
(CharSequence name, Object... values) Adds a new header with the specified name and values.addObject
(Iterable<? extends Map.Entry<? extends CharSequence, ?>> entries) Adds all header names and values of the specifiedentries
.addTimeMillis
(CharSequence name, long value) Adds a new header.build()
Returns a newly createdHttpHeaders
with the entries in this builder.clear()
Removes all headers.boolean
contains
(CharSequence name) Returnstrue
if a header with thename
exists,false
otherwise.boolean
contains
(CharSequence name, String value) Returnstrue
if a header with thename
andvalue
exists.boolean
containsBoolean
(CharSequence name, boolean value) Returnstrue
if a header with thename
andvalue
exists.boolean
containsDouble
(CharSequence name, double value) Returnstrue
if a header with thename
andvalue
exists.boolean
containsFloat
(CharSequence name, float value) Returnstrue
if a header with thename
andvalue
exists.boolean
containsInt
(CharSequence name, int value) Returnstrue
if a header with thename
andvalue
exists.boolean
containsLong
(CharSequence name, long value) Returnstrue
if a header with thename
andvalue
exists.boolean
containsObject
(CharSequence name, Object value) Returnstrue
if a header with thename
andvalue
exists.boolean
containsTimeMillis
(CharSequence name, long value) Returnstrue
if a header with thename
andvalue
exists.Returns the parsed"content-disposition"
header.contentDisposition
(ContentDisposition contentDisposition) Sets the"content-disposition"
header.long
Returns the value of the content-length header, or-1
if this value is not known.contentLength
(long contentLength) Sets the content-length header.Returns the parsed"content-type"
header.contentType
(MediaType contentType) Sets the"content-type"
header.endOfStream
(boolean endOfStream) Sets whether the headers will be the last frame in an HTTP/2 stream.void
forEach
(BiConsumer<AsciiString, String> action) Invokes the specifiedaction
for all header entries.void
forEachValue
(CharSequence name, Consumer<String> action) Invokes the specifiedaction
for all values of the headers with the specifiedname
.get
(CharSequence name) Returns the value of a header with the specifiedname
.get
(CharSequence name, String defaultValue) Returns the value of a header with the specifiedname
.getAll
(CharSequence name) Returns all values for the header with the specified name.getAllAndRemove
(CharSequence name) Removes all the headers with the specified name and returns the removed header values.getAndRemove
(CharSequence name) Removes all the headers with the specified name and returns the header value which was added first.getAndRemove
(CharSequence name, String defaultValue) Removes all the headers with the specified name and returns the header value which was added first.getBoolean
(CharSequence name) Returns theboolean
value of a header with the specifiedname
.boolean
getBoolean
(CharSequence name, boolean defaultValue) Returns theboolean
value of a header with the specifiedname
.getDouble
(CharSequence name) Returns thedouble
value of a header with the specifiedname
.double
getDouble
(CharSequence name, double defaultValue) Returns thedouble
value of a header with the specifiedname
.Removes all the headers with the specified name and returns the header value which was added first.double
getDoubleAndRemove
(CharSequence name, double defaultValue) Removes all the headers with the specified name and returns the header value which was added first.getFloat
(CharSequence name) Returns thefloat
value of a header with the specifiedname
.float
getFloat
(CharSequence name, float defaultValue) Returns thefloat
value of a header with the specifiedname
.Removes all the headers with the specified name and returns the header value which was added first.float
getFloatAndRemove
(CharSequence name, float defaultValue) Removes all the headers with the specified name and returns the header value which was added first.getInt
(CharSequence name) Returns theint
value of a header with the specifiedname
.int
getInt
(CharSequence name, int defaultValue) Returns theint
value of a header with the specifiedname
.getIntAndRemove
(CharSequence name) Removes all the headers with the specified name and returns the header value which was added first.int
getIntAndRemove
(CharSequence name, int defaultValue) Removes all the headers with the specified name and returns the header value which was added first.getLast
(CharSequence name) Returns the value of a header with the specifiedname
.getLast
(CharSequence name, String defaultValue) Returns the value of a header with the specifiedname
.getLastBoolean
(CharSequence name) Returns theboolean
value of a header with the specifiedname
.boolean
getLastBoolean
(CharSequence name, boolean defaultValue) Returns theboolean
value of a header with the specifiedname
.getLastDouble
(CharSequence name) Returns thedouble
value of a header with the specifiedname
.double
getLastDouble
(CharSequence name, double defaultValue) Returns thedouble
value of a header with the specifiedname
.getLastFloat
(CharSequence name) Returns thefloat
value of a header with the specifiedname
.float
getLastFloat
(CharSequence name, float defaultValue) Returns thefloat
value of a header with the specifiedname
.getLastInt
(CharSequence name) Returns theint
value of a header with the specifiedname
.int
getLastInt
(CharSequence name, int defaultValue) Returns theint
value of a header with the specifiedname
.getLastLong
(CharSequence name) Returns thelong
value of a header with the specifiedname
.long
getLastLong
(CharSequence name, long defaultValue) Returns thelong
value of a header with the specifiedname
.Returns the value of a header with the specifiedname
in milliseconds.long
getLastTimeMillis
(CharSequence name, long defaultValue) Returns the value of a header with the specifiedname
in milliseconds.getLong
(CharSequence name) Returns thelong
value of a header with the specifiedname
.long
getLong
(CharSequence name, long defaultValue) Returns thelong
value of a header with the specifiedname
.getLongAndRemove
(CharSequence name) Removes all the headers with the specified name and returns the header value which was added first.long
getLongAndRemove
(CharSequence name, long defaultValue) Removes all the headers with the specified name and returns the header value which was added first.getTimeMillis
(CharSequence name) Returns the value of a header with the specifiedname
in milliseconds.long
getTimeMillis
(CharSequence name, long defaultValue) Returns the value of a header with the specifiedname
in milliseconds.Removes all the headers with the specified name and returns the header value which was added first.long
getTimeMillisAndRemove
(CharSequence name, long defaultValue) Removes all the headers with the specified name and returns the header value which was added first.boolean
isEmpty()
Returnstrue
if this headers does not contain any entries.boolean
Tells whether the headers correspond to the last frame in an HTTP/2 stream.iterator()
Returns anIterator
that yields all header entries.names()
Returns aSet
of all header names.boolean
remove
(CharSequence name) Removes all headers with the specifiedname
.removeAndThen
(CharSequence name) Removes all headers with the specifiedname
.set
(CharSequence name, Iterable<String> values) Sets a new header with the specified name and values.set
(CharSequence name, String value) Sets a header with the specified name and value.set
(CharSequence name, String... values) Sets a header with the specified name and values.set
(Iterable<? extends Map.Entry<? extends CharSequence, String>> entries) Retains all current headers but callsset(CharSequence, String)
for each header in the specifiedentries
.default HttpHeadersBuilder
set
(Map<? extends CharSequence, String> entries) Retains all current headers but callsset(CharSequence, String)
for each header in the specifiedentries
.setDouble
(CharSequence name, double value) Sets a header with the specifiedname
tovalue
.setFloat
(CharSequence name, float value) Sets a header with the specifiedname
tovalue
.setIfAbsent
(Iterable<? extends Map.Entry<? extends CharSequence, String>> entries) Copies the entries missing in this headers from the specifiedentries
.setInt
(CharSequence name, int value) Sets a header with the specifiedname
tovalue
.setLong
(CharSequence name, long value) Sets a header with the specifiedname
tovalue
.setObject
(CharSequence name, Iterable<?> values) Sets a header with the specified name and values.setObject
(CharSequence name, Object value) Sets a new header.setObject
(CharSequence name, Object... values) Sets a header with the specified name and values.setObject
(Iterable<? extends Map.Entry<? extends CharSequence, ?>> entries) Retains all current headers but callssetObject(CharSequence, Object)
for each entry in the specifiedentries
.setTimeMillis
(CharSequence name, long value) Sets a header with the specifiedname
tovalue
.int
size()
Returns the number of headers.sizeHint
(int sizeHint) Specifies the hint about the number of headers which may improve the memory efficiency and performance of the underlying data structure.default Stream<Map.Entry<AsciiString,
String>> stream()
Returns aStream
that yields all header entries.valueIterator
(CharSequence name) Returns anIterator
that yields all values of the headers with the specifiedname
.valueStream
(CharSequence name) Returns aStream
that yields all values of the headers with the specifiedname
.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
build
HttpHeaders build()Returns a newly createdHttpHeaders
with the entries in this builder. -
sizeHint
Specifies the hint about the number of headers which may improve the memory efficiency and performance of the underlying data structure.- Returns:
this
- Throws:
IllegalStateException
- if the hint was specified too late after the underlying data structure has been fully initialized.
-
endOfStream
Sets whether the headers will be the last frame in an HTTP/2 stream. -
contentLength
Sets the content-length header. -
contentType
Sets the"content-type"
header. -
contentDisposition
Sets the"content-disposition"
header. -
getAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header name- Returns:
- the first header value or
null
if there is no such header
-
getAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header namedefaultValue
- the default value- Returns:
- the first header value or
defaultValue
if there is no such header
-
getAllAndRemove
Removes all the headers with the specified name and returns the removed header values. -
getIntAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header name- Returns:
- the
int
value of the first value in insertion order ornull
if there is no such value or it can't be converted intoint
.
-
getIntAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header namedefaultValue
- the default value- Returns:
- the
int
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted intoint
.
-
getLongAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header name- Returns:
- the
long
value of the first value in insertion order ornull
if there is no such value or it can't be converted intolong
.
-
getLongAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header namedefaultValue
- the default value- Returns:
- the
long
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted intolong
.
-
getFloatAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header name- Returns:
- the
float
value of the first value in insertion order ornull
if there is no such value or it can't be converted intofloat
.
-
getFloatAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header namedefaultValue
- the default value- Returns:
- the
float
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted intofloat
.
-
getDoubleAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header name- Returns:
- the
double
value of the first value in insertion order ornull
if there is no such value or it can't be converted intodouble
.
-
getDoubleAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header namedefaultValue
- the default value- Returns:
- the
double
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted intodouble
.
-
getTimeMillisAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header name- Returns:
- the milliseconds value of the first value in insertion order or
null
if there is no such value or it can't be converted into milliseconds.
-
getTimeMillisAndRemove
Removes all the headers with the specified name and returns the header value which was added first.- Parameters:
name
- the header namedefaultValue
- the default value- Returns:
- the milliseconds value of the first value in insertion order or
defaultValue
if there is no such value or it can't be converted into milliseconds.
-
add
Adds a new header with the specifiedname
andvalue
.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
add
Adds new headers with the specifiedname
andvalues
. This method is semantically equivalent tofor (String value : values) { builder.add(name, value); }
- Parameters:
name
- the header namevalues
- the header values- Returns:
this
-
add
Adds new headers with the specifiedname
andvalues
. This method is semantically equivalent tofor (String value : values) { builder.add(name, value); }
- Parameters:
name
- the header namevalues
- the header values- Returns:
this
-
add
Adds all header names and values of the specifiedentries
.- Returns:
this
- Throws:
IllegalArgumentException
- ifentries == this
.
-
add
Adds all header names and values of the specifiedentries
.- Returns:
this
-
addObject
Adds a new header. The specified header value is converted into aString
, as explained in Specifying a non-String header value.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
addObject
Adds a new header with the specified name and values. The specified header values are converted intoString
s, as explained in Specifying a non-String header value. This method is equivalent to:for (Object v : values) { builder.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the header values- Returns:
this
-
addObject
Adds a new header with the specified name and values. The specified header values are converted intoString
s, as explained in Specifying a non-String header value. This method is equivalent to:for (Object v : values) { builder.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the header values- Returns:
this
-
addObject
Adds all header names and values of the specifiedentries
. The specified header values are converted intoString
s, as explained in Specifying a non-String header value.- Returns:
this
- Throws:
IllegalArgumentException
- ifentries == this
.
-
addInt
Adds a new header.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
addLong
Adds a new header.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
addFloat
Adds a new header.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
addDouble
Adds a new header.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
addTimeMillis
Adds a new header.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
set
Sets a header with the specified name and value. Any existing headers with the same name are overwritten.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
set
Sets a new header with the specified name and values. This method is equivalent tobuilder.remove(name); for (String v : values) { builder.add(name, v); }
- Parameters:
name
- the header namevalues
- the header values- Returns:
this
-
set
Sets a header with the specified name and values. Any existing headers with the specified name are removed. This method is equivalent to:builder.remove(name); for (String v : values) { builder.add(name, v); }
- Parameters:
name
- the header namevalues
- the header values- Returns:
this
-
set
Retains all current headers but callsset(CharSequence, String)
for each header in the specifiedentries
.- Parameters:
entries
- the headers used to set the header values- Returns:
this
-
set
Retains all current headers but callsset(CharSequence, String)
for each header in the specifiedentries
.- Parameters:
entries
- the headers used to set the header values- Returns:
this
-
setIfAbsent
HttpHeadersBuilder setIfAbsent(Iterable<? extends Map.Entry<? extends CharSequence, String>> entries) Copies the entries missing in this headers from the specifiedentries
. This method is a shortcut for:headers.names().forEach(name -> { if (!builder.contains(name)) { builder.set(name, headers.getAll(name)); } });
- Returns:
this
-
setObject
Sets a new header. Any existing headers with the specified name are removed. The specified header value is converted into aString
, as explained in Specifying a non-String header value.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
setObject
Sets a header with the specified name and values. Any existing headers with the specified name are removed. The specified header values are converted intoString
s, as explained in Specifying a non-String header value. This method is equivalent to:builder.remove(name); for (Object v : values) { builder.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
setObject
Sets a header with the specified name and values. Any existing headers with the specified name are removed. The specified header values are converted intoString
s, as explained in Specifying a non-String header value. This method is equivalent to:builder.remove(name); for (Object v : values) { builder.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
setObject
Retains all current headers but callssetObject(CharSequence, Object)
for each entry in the specifiedentries
. The specified header values are converted intoString
s, as explained in Specifying a non-String header value.- Parameters:
entries
- the headers used to set the values in this instance- Returns:
this
-
setInt
Sets a header with the specifiedname
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
setLong
Sets a header with the specifiedname
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
setFloat
Sets a header with the specifiedname
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
setDouble
Sets a header with the specifiedname
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
setTimeMillis
Sets a header with the specifiedname
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- the header namevalue
- the header value- Returns:
this
-
remove
Removes all headers with the specifiedname
.- Parameters:
name
- the header name- Returns:
true
if at least one entry has been removed.
-
removeAndThen
Removes all headers with the specifiedname
. Unlikeremove(CharSequence)
this method returns itself so that the caller can chain the invocations.- Parameters:
name
- the header name- Returns:
this
-
clear
HttpHeadersBuilder clear()Removes all headers. After a call to this method,size()
becomes0
.- Returns:
this
-
isEndOfStream
boolean isEndOfStream()Tells whether the headers correspond to the last frame in an HTTP/2 stream. -
contentLength
long contentLength()Returns the value of the content-length header, or-1
if this value is not known. -
contentType
Returns the parsed"content-type"
header.- Returns:
- the parsed
MediaType
if present and valid, ornull
otherwise.
-
contentDisposition
Returns the parsed"content-disposition"
header.- Returns:
- the parsed
MediaType
if present and valid.null
if not present or failed to parse"content-disposition"
header.
-
get
Returns the value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the first header value if the header is found, or
null
if there's no such header
-
get
Returns the value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the first header value or
defaultValue
if there is no such header
-
getLast
Returns the value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the last header value if the header is found, or
null
if there's no such header
-
getLast
Returns the value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the last header value or
defaultValue
if there is no such header
-
getAll
Returns all values for the header with the specified name. The returnedList
can't be modified. -
getBoolean
Returns theboolean
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
boolean
value of the first value in insertion order ornull
if there is no such header or it can't be converted toboolean
.
-
getBoolean
Returns theboolean
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
boolean
value of the first value in insertion order ordefaultValue
if there is no such header or it can't be converted toboolean
.
-
getLastBoolean
Returns theboolean
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
boolean
value of the last value in insertion order ornull
if there is no such header or it can't be converted toboolean
.
-
getLastBoolean
Returns theboolean
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
boolean
value of the last value in insertion order ordefaultValue
if there is no such header or it can't be converted toboolean
.
-
getLastInt
Returns theint
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
int
value of the last value in insertion order ornull
if there is no such header or it can't be converted toint
.
-
getLastInt
Returns theint
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
int
value of the last value in insertion order ordefaultValue
if there is no such header or it can't be converted toint
.
-
getInt
Returns theint
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
int
value of the first value in insertion order ornull
if there is no such header or it can't be converted toint
.
-
getInt
Returns theint
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
int
value of the first value in insertion order ordefaultValue
if there is no such header or it can't be converted toint
.
-
getLong
Returns thelong
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
long
value of the first value in insertion order ornull
if there is no such header or it can't be converted tolong
.
-
getLong
Returns thelong
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
long
value of the first value in insertion order ordefaultValue
if there is no such header or it can't be converted tolong
.
-
getLastLong
Returns thelong
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
long
value of the last value in insertion order ornull
if there is no such header or it can't be converted tolong
.
-
getLastLong
Returns thelong
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
long
value of the last value in insertion order ordefaultValue
if there is no such header or it can't be converted tolong
.
-
getFloat
Returns thefloat
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
float
value of the first value in insertion order ornull
if there is no such header or it can't be converted tofloat
.
-
getFloat
Returns thefloat
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
float
value of the first value in insertion order ordefaultValue
if there is no such header or it can't be converted tofloat
.
-
getLastFloat
Returns thefloat
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
float
value of the last value in insertion order ornull
if there is no such header or it can't be converted tofloat
.
-
getLastFloat
Returns thefloat
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
float
value of the last value in insertion order ordefaultValue
if there is no such header or it can't be converted tofloat
.
-
getDouble
Returns thedouble
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
double
value of the first value in insertion order ornull
if there is no such header or it can't be converted todouble
.
-
getDouble
Returns thedouble
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
double
value of the first value in insertion order ordefaultValue
if there is no such header or it can't be converted todouble
.
-
getLastDouble
Returns thedouble
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
double
value of the last value in insertion order ornull
if there is no such header or it can't be converted todouble
.
-
getLastDouble
Returns thedouble
value of a header with the specifiedname
. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
double
value of the last value in insertion order ordefaultValue
if there is no such header or it can't be converted todouble
.
-
getTimeMillis
Returns the value of a header with the specifiedname
in milliseconds. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the milliseconds value of the first value in insertion order or
null
if there is no such header or it can't be converted to milliseconds.
-
getTimeMillis
Returns the value of a header with the specifiedname
in milliseconds. If there are more than one value for the specifiedname
, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the milliseconds value of the first value in insertion order or
defaultValue
if there is no such header or it can't be converted to milliseconds.
-
getLastTimeMillis
Returns the value of a header with the specifiedname
in milliseconds. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the milliseconds value of the last value in insertion order or
null
if there is no such header or it can't be converted to milliseconds.
-
getLastTimeMillis
Returns the value of a header with the specifiedname
in milliseconds. If there are more than one value for the specifiedname
, the last value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the milliseconds value of the last value in insertion order or
defaultValue
if there is no such header or it can't be converted to milliseconds.
-
contains
Returnstrue
if a header with thename
exists,false
otherwise.- Parameters:
name
- the header name
-
contains
Returnstrue
if a header with thename
andvalue
exists.- Parameters:
name
- the header namevalue
- the header value of the header to find
-
containsObject
Returnstrue
if a header with thename
andvalue
exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if the header exists.false
otherwise
-
containsBoolean
Returnstrue
if a header with thename
andvalue
exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if the header exists.false
otherwise
-
containsInt
Returnstrue
if a header with thename
andvalue
exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if the header exists.false
otherwise
-
containsLong
Returnstrue
if a header with thename
andvalue
exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if the header exists.false
otherwise
-
containsFloat
Returnstrue
if a header with thename
andvalue
exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if the header exists.false
otherwise
-
containsDouble
Returnstrue
if a header with thename
andvalue
exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if the header exists.false
otherwise
-
containsTimeMillis
Returnstrue
if a header with thename
andvalue
exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if the header exists.false
otherwise
-
size
int size()Returns the number of headers. -
isEmpty
boolean isEmpty()Returnstrue
if this headers does not contain any entries. -
names
Set<AsciiString> names() -
iterator
Iterator<Map.Entry<AsciiString,String>> iterator()Returns anIterator
that yields all header entries. The iteration order is as follows:- All pseudo headers (order not specified).
- All non-pseudo headers (in insertion order).
- Specified by:
iterator
in interfaceIterable<Map.Entry<AsciiString,
String>>
-
valueIterator
Returns anIterator
that yields all values of the headers with the specifiedname
. -
forEach
Invokes the specifiedaction
for all header entries. -
forEachValue
Invokes the specifiedaction
for all values of the headers with the specifiedname
. -
stream
Returns aStream
that yields all header entries. -
valueStream
Returns aStream
that yields all values of the headers with the specifiedname
.
-