Class HeadersUtils
java.lang.Object
io.netty.handler.codec.HeadersUtils
public final class HeadersUtils
extends java.lang.Object
Provides utility methods related to
Headers.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate static final classprivate static final classprivate static final class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> java.util.List <java.lang.String> getAllAsString(Headers<K, V, ?> headers, K name) static <K,V> java.lang.String getAsString(Headers<K, V, ?> headers, K name) Headers.get(Object)and convert the result to aString.static java.util.Iterator<java.util.Map.Entry<java.lang.String, java.lang.String>> iteratorAsString(java.lang.Iterable<java.util.Map.Entry<java.lang.CharSequence, java.lang.CharSequence>> headers) static java.util.Set<java.lang.String> namesAsString(Headers<java.lang.CharSequence, java.lang.CharSequence, ?> headers) static <K,V> java.lang.String toString(java.lang.Class<?> headersClass, java.util.Iterator<java.util.Map.Entry<K, V>> headersIt, int size) Helper for implementing toString forDefaultHeadersand wrappers such as DefaultHttpHeaders.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
HeadersUtils
private HeadersUtils()
-
-
Method Details
-
getAllAsString
- Parameters:
name- the name of the header to retrieve- Returns:
- a
Listof header values or an emptyListif no values are found.
-
getAsString
Headers.get(Object)and convert the result to aString.- Parameters:
headers- the headers to get thenamefromname- the name of the header to retrieve- Returns:
- the first header value if the header is found.
nullif there's no such entry.
-
iteratorAsString
public static java.util.Iterator<java.util.Map.Entry<java.lang.String, java.lang.String>> iteratorAsString(java.lang.Iterable<java.util.Map.Entry<java.lang.CharSequence, java.lang.CharSequence>> headers) -
toString
public static <K,V> java.lang.String toString(java.lang.Class<?> headersClass, java.util.Iterator<java.util.Map.Entry<K, V>> headersIt, int size) Helper for implementing toString forDefaultHeadersand wrappers such as DefaultHttpHeaders.- Parameters:
headersClass- the class of headersheadersIt- the iterator on the actual headerssize- the size of the iterator- Returns:
- a String representation of the headers
-
namesAsString
public static java.util.Set<java.lang.String> namesAsString(Headers<java.lang.CharSequence, java.lang.CharSequence, ?> headers) - Parameters:
headers- the headers to get the names from- Returns:
- a
Setof header values or an emptySetif no values are found.
-