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
-
-
Constructor Summary
Constructors Constructor Description HeaderMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HeaderMap
add(HttpString headerName, long headerValue)
HeaderMap
add(HttpString headerName, String headerValue)
HeaderMap
addAll(HttpString headerName, Collection<String> headerValues)
HeaderMap
addFirst(HttpString headerName, String headerValue)
HeaderMap
addLast(HttpString headerName, String headerValue)
HeaderMap
clear()
boolean
contains(HttpString headerName)
boolean
contains(String headerName)
int
count(HttpString headerName)
int
count(String headerName)
Iterable<String>
eachValue(HttpString headerName)
boolean
equals(Object o)
long
fastIterate()
Do a fast iteration of this header map without creating any objects.long
fastIterateNonEmpty()
Do a fast iteration of this header map without creating any objects, only considering non-empty header values.HeaderValues
fiCurrent(long cookie)
Return the value at the current index in a fast iteration.long
fiNext(long cookie)
Find the next index in a fast iteration.long
fiNextNonEmpty(long cookie)
Find the next non-empty index in a fast iteration.HeaderValues
get(HttpString headerName)
String
get(HttpString headerName, int index)
HeaderValues
get(String headerName)
String
get(String headerName, int index)
String
getFirst(HttpString headerName)
String
getFirst(String headerName)
Collection<HttpString>
getHeaderNames()
String
getLast(HttpString headerName)
String
getLast(String headerName)
int
hashCode()
Iterator<HeaderValues>
iterator()
HeaderMap
put(HttpString headerName, long headerValue)
HeaderMap
put(HttpString headerName, String headerValue)
HeaderMap
putAll(HttpString headerName, Collection<String> headerValues)
Collection<String>
remove(HttpString headerName)
Collection<String>
remove(String headerName)
int
size()
String
toString()
-
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:
iterator
in 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)
-
-