Top Description Inners Constructors Methods
io.netty.handler.codec

public final Class HeadersUtils

extends Object
Class Inheritance
Imports
java.util.AbstractCollection, .AbstractList, .Iterator, .List, .Map.Entry, .Set

Provides utility methods related to Headers.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <K, V> List<String>

Returns:

a List of header values or an empty List if no values are found.
getAllAsString
(Headers<K, V, ?> headers, K
the name of the header to retrieve
name
)

Headers#get(Object) and convert each element of List to a String.

public static <K, V> String

Returns:

the first header value if the header is found. null if there's no such entry.
getAsString
(Headers<K, V, ?>
the headers to get the name from
headers
,
K
the name of the header to retrieve
name
)

Headers#get(Object) and convert the result to a String.

public static Iterator<Map.Entry<String, String>>
iteratorAsString(Iterable<Map.Entry<CharSequence, CharSequence>> headers)

Headers#iterator() which converts each Entry's key and value to a String.

public static Set<String>

Returns:

a Set of header values or an empty Set if no values are found.
namesAsString
(Headers<CharSequence, CharSequence, ?>
the headers to get the names from
headers
)

Headers#names() and convert each element of Set to a String.

public static <K, V> String

Returns:

a String representation of the headers
toString
(Class<?>
the class of headers
headersClass
,
Iterator<Map.Entry<K, V>>
the iterator on the actual headers
headersIt
,
int
the size of the iterator
size
)

Helper for implementing toString for DefaultHeaders and wrappers such as DefaultHttpHeaders.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

HeadersUtilsback to summary
private HeadersUtils()

Method Detail

getAllAsStringback to summary
public static <K, V> List<String> getAllAsString(Headers<K, V, ?> headers, K name)

Headers#get(Object) and convert each element of List to a String.

Parameters
name:K

the name of the header to retrieve

Returns:List<String>

a List of header values or an empty List if no values are found.

getAsStringback to summary
public static <K, V> String getAsString(Headers<K, V, ?> headers, K name)

Headers#get(Object) and convert the result to a String.

Parameters
headers:Headers<K, V, ?>

the headers to get the name from

name:K

the name of the header to retrieve

Returns:String

the first header value if the header is found. null if there's no such entry.

iteratorAsStringback to summary
public static Iterator<Map.Entry<String, String>> iteratorAsString(Iterable<Map.Entry<CharSequence, CharSequence>> headers)

Headers#iterator() which converts each Entry's key and value to a String.

namesAsStringback to summary
public static Set<String> namesAsString(Headers<CharSequence, CharSequence, ?> headers)

Headers#names() and convert each element of Set to a String.

Parameters
headers:Headers<CharSequence, CharSequence, ?>

the headers to get the names from

Returns:Set<String>

a Set of header values or an empty Set if no values are found.

toStringback to summary
public static <K, V> String toString(Class<?> headersClass, Iterator<Map.Entry<K, V>> headersIt, int size)

Helper for implementing toString for DefaultHeaders and wrappers such as DefaultHttpHeaders.

Parameters
headersClass:Class<?>

the class of headers

headersIt:Iterator<Map.Entry<K, V>>

the iterator on the actual headers

size:int

the size of the iterator

Returns:String

a String representation of the headers

io.netty.handler.codec back to summary

private final Class HeadersUtils.DelegatingNameSet

extends AbstractCollection<String>
implements Set<String>
Class Inheritance
All Implemented Interfaces
java.util.Set, java.util.Collection, java.lang.Iterable

Field Summary

Modifier and TypeField and Description
private final Headers<CharSequence, CharSequence, ?>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(Object
element whose presence in this set is to be tested
o
)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Returns true if this set contains the specified element.
public boolean
isEmpty()

Overrides java.util.AbstractCollection.isEmpty.

Implements java.util.Set.isEmpty, java.util.Collection.isEmpty.

Returns true if this set contains no elements.
public Iterator<String>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).
Inherited from java.util.AbstractCollection:
addaddAllclearcontainsAllremoveremoveAllretainAlltoArraytoArraytoString

Field Detail

headersback to summary
private final Headers<CharSequence, CharSequence, ?> headers

Constructor Detail

DelegatingNameSetback to summary
pack-priv DelegatingNameSet(Headers<CharSequence, CharSequence, ?> headers)

Method Detail

containsback to summary
public boolean contains(Object o)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Doc from java.util.Set.contains.

Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that Objects.equals(o, e).

Parameters
o:Object

element whose presence in this set is to be tested

Returns:boolean

true if this set contains the specified element

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Overrides java.util.AbstractCollection.isEmpty.

Implements java.util.Set.isEmpty, java.util.Collection.isEmpty.

Doc from java.util.Set.isEmpty.

Returns true if this set contains no elements.

Returns:boolean

true if this set contains no elements

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

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.Set.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

Returns:Iterator<String>

an iterator over the elements in this set

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this set (its cardinality)

Annotations
@Override
io.netty.handler.codec back to summary

private final Class HeadersUtils.StringEntry

extends Object
implements Map.Entry<String, String>
Class Inheritance
All Implemented Interfaces
java.util.Map.Entry

Field Summary

Modifier and TypeField and Description
private final Map.Entry<CharSequence, CharSequence>
private String
private String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public String
getKey()

Implements java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.
public String
getValue()

Implements java.util.Map.Entry.getValue.

Returns the value corresponding to this entry.
public String
setValue(String
new value to be stored in this entry
value
)

Implements java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation).
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

entryback to summary
private final Map.Entry<CharSequence, CharSequence> entry
nameback to summary
private String name
valueback to summary
private String value

Constructor Detail

StringEntryback to summary
pack-priv StringEntry(Map.Entry<CharSequence, CharSequence> entry)

Method Detail

getKeyback to summary
public String getKey()

Implements java.util.Map.Entry.getKey.

Doc from java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.

Returns:String

the key corresponding to this entry

Annotations
@Override
getValueback to summary
public String getValue()

Implements java.util.Map.Entry.getValue.

Doc from java.util.Map.Entry.getValue.

Returns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator's remove operation), the results of this call are undefined.

Returns:String

the value corresponding to this entry

Annotations
@Override
setValueback to summary
public String setValue(String value)

Implements java.util.Map.Entry.setValue.

Doc from java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation). (Writes through to the map.) The behavior of this call is undefined if the mapping has already been removed from the map (by the iterator's remove operation).

Parameters
value:String

new value to be stored in this entry

Returns:String

old value corresponding to the entry

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
io.netty.handler.codec back to summary

private final Class HeadersUtils.StringEntryIterator

extends Object
implements Iterator<Map.Entry<String, String>>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private final Iterator<Map.Entry<CharSequence, CharSequence>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public Map.Entry<String, String>
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iterback to summary
private final Iterator<Map.Entry<CharSequence, CharSequence>> iter

Constructor Detail

StringEntryIteratorback to summary
pack-priv StringEntryIterator(Iterator<Map.Entry<CharSequence, CharSequence>> iter)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public Map.Entry<String, String> next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Map.Entry<String, String>

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override
io.netty.handler.codec back to summary

private final Class HeadersUtils.StringIterator<T>

extends Object
implements Iterator<String>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private final Iterator<T>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public String
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iterback to summary
private final Iterator<T> iter

Constructor Detail

StringIteratorback to summary
pack-priv StringIterator(Iterator<T> iter)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public String next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:String

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override