Top Description Fields Constructors Methods
io.undertow.util

public final Class HeaderMap

extends Object
implements Iterable<HeaderValues>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Static Imports
org.wildfly.common.Assert.checkNotNullParam

An optimized array-backed header map.
Authors
David M. Lloyd, Flavia Rainone

Field Summary

Modifier and TypeField and Description
private Collection<HttpString>
private int
private Object[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public HeaderMap
add(HttpString headerName, String headerValue)

public HeaderMap
add(HttpString headerName, long headerValue)

public HeaderMap
addAll(HttpString headerName, Collection<String> headerValues)

public HeaderMap
addFirst(final HttpString headerName, final String headerValue)

public HeaderMap
addLast(final HttpString headerName, final String headerValue)

public HeaderMap
public boolean
contains(HttpString headerName)

public boolean
contains(String headerName)

public int
count(HttpString headerName)

public int
count(String headerName)

public Iterable<String>
eachValue(final HttpString headerName)

public boolean
equals(final Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public long

Returns:

an opaque iterating cookie, or -1 if no iteration is possible
fastIterate
()

Do a fast iteration of this header map without creating any objects.

public long

Returns:

an opaque iterating cookie, or -1 if no iteration is possible
fastIterateNonEmpty
()

Do a fast iteration of this header map without creating any objects, only considering non-empty header values.

public HeaderValues

Returns:

the values object at this position
fiCurrent
(long
the iteration cookie value
cookie
)

Return the value at the current index in a fast iteration.

public long

Returns:

the next cookie value, or -1L if iteration is done
fiNext
(long
the previous cookie value
cookie
)

Find the next index in a fast iteration.

public long

Returns:

the next cookie value, or -1L if iteration is done
fiNextNonEmpty
(long
the previous cookie value
cookie
)

Find the next non-empty index in a fast iteration.

public HeaderValues
get(final HttpString headerName)

public HeaderValues
get(final String headerName)

public String
get(HttpString headerName, int index)

public String
get(String headerName, int index)

private HeaderValues
getEntry(final HttpString headerName)

private HeaderValues
getEntry(final String headerName)

public String
getFirst(HttpString headerName)

public String
getFirst(String headerName)

public Collection<HttpString>
public String
getLast(HttpString headerName)

public String
getLast(String headerName)

private HeaderValues
getOrCreateEntry(final HttpString headerName)

private HeaderValues
getOrCreateNonEmpty(HttpString headerName, Object[] table, int length, int idx, Object o)

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public Iterator<HeaderValues>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public HeaderMap
put(HttpString headerName, String headerValue)

public HeaderMap
put(HttpString headerName, long headerValue)

public HeaderMap
putAll(HttpString headerName, Collection<String> headerValues)

public HeaderMap
putAll(HeaderMap headerMap)

public Collection<String>
remove(HttpString headerName)

public Collection<String>
remove(String headerName)

private HeaderValues
removeEntry(final HttpString headerName)

private HeaderValues
removeEntry(final String headerName)

private void
public int
size()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

headerNamesback to summary
private Collection<HttpString> headerNames
sizeback to summary
private int size
tableback to summary
private Object[] table

Constructor Detail

HeaderMapback to summary
public HeaderMap()

Method Detail

addback to summary
public HeaderMap add(HttpString headerName, String headerValue)
addback to summary
public HeaderMap add(HttpString headerName, long headerValue)
addAllback to summary
public HeaderMap addAll(HttpString headerName, Collection<String> headerValues)
addFirstback to summary
public HeaderMap addFirst(final HttpString headerName, final String headerValue)
addLastback to summary
public HeaderMap addLast(final HttpString headerName, final String headerValue)
clearback to summary
public HeaderMap clear()
containsback to summary
public boolean contains(HttpString headerName)
containsback to summary
public boolean contains(String headerName)
countback to summary
public int count(HttpString headerName)
countback to summary
public int count(String headerName)
eachValueback to summary
public Iterable<String> eachValue(final HttpString headerName)
equalsback to summary
public boolean equals(final Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
fastIterateback to summary
public long fastIterate()

Do a fast iteration of this header map without creating any objects.

Returns:long

an opaque iterating cookie, or -1 if no iteration is possible

See Also
fiNext(long), fiCurrent(long)
fastIterateNonEmptyback to summary
public long fastIterateNonEmpty()

Do a fast iteration of this header map without creating any objects, only considering non-empty header values.

Returns:long

an opaque iterating cookie, or -1 if no iteration is possible

fiCurrentback to summary
public HeaderValues fiCurrent(long cookie)

Return the value at the current index in a fast iteration.

Parameters
cookie:long

the iteration cookie value

Returns:HeaderValues

the values object at this position

Exceptions
NoSuchElementException:
if the cookie value is invalid
fiNextback to summary
public long fiNext(long cookie)

Find the next index in a fast iteration.

Parameters
cookie:long

the previous cookie value

Returns:long

the next cookie value, or -1L if iteration is done

fiNextNonEmptyback to summary
public long fiNextNonEmpty(long cookie)

Find the next non-empty index in a fast iteration.

Parameters
cookie:long

the previous cookie value

Returns:long

the next cookie value, or -1L if iteration is done

getback to summary
public HeaderValues get(final HttpString headerName)
getback to summary
public HeaderValues get(final String headerName)
getback to summary
public String get(HttpString headerName, int index) throws IndexOutOfBoundsException
getback to summary
public String get(String headerName, int index) throws IndexOutOfBoundsException
getEntryback to summary
private HeaderValues getEntry(final HttpString headerName)
getEntryback to summary
private HeaderValues getEntry(final String headerName)
getFirstback to summary
public String getFirst(HttpString headerName)
getFirstback to summary
public String getFirst(String headerName)
getHeaderNamesback to summary
public Collection<HttpString> getHeaderNames()
getLastback to summary
public String getLast(HttpString headerName)
getLastback to summary
public String getLast(String headerName)
getOrCreateEntryback to summary
private HeaderValues getOrCreateEntry(final HttpString headerName)
getOrCreateNonEmptyback to summary
private HeaderValues getOrCreateNonEmpty(HttpString headerName, Object[] table, int length, int idx, Object o)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
iteratorback to summary
public Iterator<HeaderValues> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<HeaderValues>

an Iterator.

putback to summary
public HeaderMap put(HttpString headerName, String headerValue)
putback to summary
public HeaderMap put(HttpString headerName, long headerValue)
putAllback to summary
public HeaderMap putAll(HttpString headerName, Collection<String> headerValues)
putAllback to summary
public HeaderMap putAll(HeaderMap headerMap)
removeback to summary
public Collection<String> remove(HttpString headerName)
removeback to summary
public Collection<String> remove(String headerName)
removeEntryback to summary
private HeaderValues removeEntry(final HttpString headerName)
removeEntryback to summary
private HeaderValues removeEntry(final String headerName)
resizeback to summary
private void resize()
sizeback to summary
public int size()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override