Package io.undertow.util
Class HeaderMap
- java.lang.Object
-
- io.undertow.util.HeaderMap
-
- All Implemented Interfaces:
Iterable<HeaderValues>
public final class HeaderMap extends Object implements Iterable<HeaderValues>
An optimized array-backed header map.- Author:
- David M. Lloyd, Flavia Rainone
-
-
Constructor Summary
Constructors Constructor Description HeaderMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HeaderMapadd(HttpString headerName, long headerValue)HeaderMapadd(HttpString headerName, String headerValue)HeaderMapaddAll(HttpString headerName, Collection<String> headerValues)HeaderMapaddFirst(HttpString headerName, String headerValue)HeaderMapaddLast(HttpString headerName, String headerValue)HeaderMapclear()booleancontains(HttpString headerName)booleancontains(String headerName)intcount(HttpString headerName)intcount(String headerName)Iterable<String>eachValue(HttpString headerName)booleanequals(Object o)longfastIterate()Do a fast iteration of this header map without creating any objects.longfastIterateNonEmpty()Do a fast iteration of this header map without creating any objects, only considering non-empty header values.HeaderValuesfiCurrent(long cookie)Return the value at the current index in a fast iteration.longfiNext(long cookie)Find the next index in a fast iteration.longfiNextNonEmpty(long cookie)Find the next non-empty index in a fast iteration.HeaderValuesget(HttpString headerName)Stringget(HttpString headerName, int index)HeaderValuesget(String headerName)Stringget(String headerName, int index)StringgetFirst(HttpString headerName)StringgetFirst(String headerName)Collection<HttpString>getHeaderNames()StringgetLast(HttpString headerName)StringgetLast(String headerName)inthashCode()Iterator<HeaderValues>iterator()HeaderMapput(HttpString headerName, long headerValue)HeaderMapput(HttpString headerName, String headerValue)HeaderMapputAll(HeaderMap headerMap)HeaderMapputAll(HttpString headerName, Collection<String> headerValues)Collection<String>remove(HttpString headerName)Collection<String>remove(String headerName)intsize()StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
get
public HeaderValues get(HttpString headerName)
-
get
public HeaderValues get(String headerName)
-
getFirst
public String getFirst(HttpString headerName)
-
get
public String get(HttpString headerName, int index) throws IndexOutOfBoundsException
- Throws:
IndexOutOfBoundsException
-
get
public String get(String headerName, int index) throws IndexOutOfBoundsException
- Throws:
IndexOutOfBoundsException
-
getLast
public String getLast(HttpString headerName)
-
count
public int count(HttpString headerName)
-
count
public int count(String headerName)
-
size
public int size()
-
fastIterate
public long fastIterate()
Do a fast iteration of this header map without creating any objects.- Returns:
- an opaque iterating cookie, or -1 if no iteration is possible
- See Also:
fiNext(long),fiCurrent(long)
-
fastIterateNonEmpty
public long fastIterateNonEmpty()
Do a fast iteration of this header map without creating any objects, only considering non-empty header values.- Returns:
- an opaque iterating cookie, or -1 if no iteration is possible
-
fiNext
public long fiNext(long cookie)
Find the next index in a fast iteration.- Parameters:
cookie- the previous cookie value- Returns:
- the next cookie value, or -1L if iteration is done
-
fiNextNonEmpty
public long fiNextNonEmpty(long cookie)
Find the next non-empty index in a fast iteration.- Parameters:
cookie- the previous cookie value- Returns:
- the next cookie value, or -1L if iteration is done
-
fiCurrent
public HeaderValues fiCurrent(long cookie)
Return the value at the current index in a fast iteration.- Parameters:
cookie- the iteration cookie value- Returns:
- the values object at this position
- Throws:
NoSuchElementException- if the cookie value is invalid
-
eachValue
public Iterable<String> eachValue(HttpString headerName)
-
iterator
public Iterator<HeaderValues> iterator()
- Specified by:
iteratorin interfaceIterable<HeaderValues>
-
getHeaderNames
public Collection<HttpString> getHeaderNames()
-
add
public HeaderMap add(HttpString headerName, String headerValue)
-
addFirst
public HeaderMap addFirst(HttpString headerName, String headerValue)
-
addLast
public HeaderMap addLast(HttpString headerName, String headerValue)
-
add
public HeaderMap add(HttpString headerName, long headerValue)
-
addAll
public HeaderMap addAll(HttpString headerName, Collection<String> headerValues)
-
put
public HeaderMap put(HttpString headerName, String headerValue)
-
put
public HeaderMap put(HttpString headerName, long headerValue)
-
putAll
public HeaderMap putAll(HttpString headerName, Collection<String> headerValues)
-
clear
public HeaderMap clear()
-
remove
public Collection<String> remove(HttpString headerName)
-
remove
public Collection<String> remove(String headerName)
-
contains
public boolean contains(HttpString headerName)
-
contains
public boolean contains(String headerName)
-
-