Class ReadOnlyHttp2Headers

java.lang.Object
io.netty.handler.codec.http2.ReadOnlyHttp2Headers
All Implemented Interfaces:
Headers<CharSequence,CharSequence,Http2Headers>, Http2Headers, Iterable<Map.Entry<CharSequence,CharSequence>>

public final class ReadOnlyHttp2Headers extends Object implements Http2Headers
A variant of Http2Headers which only supports read-only methods.

Any array passed to this class may be used directly in the underlying data structures of this class. If these arrays may be modified it is the caller's responsibility to supply this class with a copy of the array.

This may be a good alternative to DefaultHttp2Headers if your have a fixed set of headers which will not change.

  • Field Details

    • PSEUDO_HEADER_TOKEN

      private static final byte PSEUDO_HEADER_TOKEN
      See Also:
    • pseudoHeaders

      private final AsciiString[] pseudoHeaders
    • otherHeaders

      private final AsciiString[] otherHeaders
  • Constructor Details

    • ReadOnlyHttp2Headers

      private ReadOnlyHttp2Headers(boolean validateHeaders, AsciiString[] pseudoHeaders, AsciiString... otherHeaders)
  • Method Details

    • trailers

      public static ReadOnlyHttp2Headers trailers(boolean validateHeaders, AsciiString... otherHeaders)
      Used to create read only object designed to represent trailers.

      If this is used for a purpose other than trailers you may violate the header serialization ordering defined by RFC 7540, 8.1.2.1.

      Parameters:
      validateHeaders - true will run validation on each header name/value pair to ensure protocol compliance.
      otherHeaders - An array of key:value pairs. Must not contain any pseudo headers or null names/values. A copy will NOT be made of this array. If the contents of this array may be modified externally you are responsible for passing in a copy.
      Returns:
      A read only representation of the headers.
    • clientHeaders

      public static ReadOnlyHttp2Headers clientHeaders(boolean validateHeaders, AsciiString method, AsciiString path, AsciiString scheme, AsciiString authority, AsciiString... otherHeaders)
      Create a new read only representation of headers used by clients.
      Parameters:
      validateHeaders - true will run validation on each header name/value pair to ensure protocol compliance.
      method - The value for Http2Headers.PseudoHeaderName.METHOD.
      path - The value for Http2Headers.PseudoHeaderName.PATH.
      scheme - The value for Http2Headers.PseudoHeaderName.SCHEME.
      authority - The value for Http2Headers.PseudoHeaderName.AUTHORITY.
      otherHeaders - An array of key:value pairs. Must not contain any pseudo headers or null names/values. A copy will NOT be made of this array. If the contents of this array may be modified externally you are responsible for passing in a copy.
      Returns:
      a new read only representation of headers used by clients.
    • serverHeaders

      public static ReadOnlyHttp2Headers serverHeaders(boolean validateHeaders, AsciiString status, AsciiString... otherHeaders)
      Create a new read only representation of headers used by servers.
      Parameters:
      validateHeaders - true will run validation on each header name/value pair to ensure protocol compliance.
      status - The value for Http2Headers.PseudoHeaderName.STATUS.
      otherHeaders - An array of key:value pairs. Must not contain any pseudo headers or null names/values. A copy will NOT be made of this array. If the contents of this array may be modified externally you are responsible for passing in a copy.
      Returns:
      a new read only representation of headers used by servers.
    • newInvalidArraySizeException

      private static IllegalArgumentException newInvalidArraySizeException()
    • validateHeaders

      private static void validateHeaders(AsciiString[] pseudoHeaders, AsciiString... otherHeaders)
    • get0

      private AsciiString get0(CharSequence name)
    • get

      public CharSequence get(CharSequence name)
      Description copied from interface: Headers
      Returns the value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      get in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the first header value if the header is found. null if there's no such header
    • get

      public CharSequence get(CharSequence name, CharSequence defaultValue)
      Description copied from interface: Headers
      Returns the value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      get in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the first header value or defaultValue if there is no such header
    • getAndRemove

      public CharSequence getAndRemove(CharSequence name)
      Description copied from interface: Headers
      Returns the value of a header with the specified name and removes it from this object. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the first header value or null if there is no such header
    • getAndRemove

      public CharSequence getAndRemove(CharSequence name, CharSequence defaultValue)
      Description copied from interface: Headers
      Returns the value of a header with the specified name and removes it from this object. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the first header value or defaultValue if there is no such header
    • getAll

      public List<CharSequence> getAll(CharSequence name)
      Description copied from interface: Headers
      Returns all values for the header with the specified name. The returned List can't be modified.
      Specified by:
      getAll in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      a List of header values or an empty List if no values are found.
    • getAllAndRemove

      public List<CharSequence> getAllAndRemove(CharSequence name)
      Description copied from interface: Headers
      Returns all values for the header with the specified name and removes them from this object. The returned List can't be modified.
      Specified by:
      getAllAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      a List of header values or an empty List if no values are found.
    • getBoolean

      public Boolean getBoolean(CharSequence name)
      Description copied from interface: Headers
      Returns the boolean value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getBoolean in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the boolean value of the first value in insertion order or null if there is no such value or it can't be converted to boolean.
    • getBoolean

      public boolean getBoolean(CharSequence name, boolean defaultValue)
      Description copied from interface: Headers
      Returns the boolean value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getBoolean in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the boolean value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to boolean.
    • getByte

      public Byte getByte(CharSequence name)
      Description copied from interface: Headers
      Returns the byte value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getByte in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the byte value of the first value in insertion order or null if there is no such value or it can't be converted to byte.
    • getByte

      public byte getByte(CharSequence name, byte defaultValue)
      Description copied from interface: Headers
      Returns the byte value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getByte in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the byte value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to byte.
    • getChar

      public Character getChar(CharSequence name)
      Description copied from interface: Headers
      Returns the char value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getChar in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the char value of the first value in insertion order or null if there is no such value or it can't be converted to char.
    • getChar

      public char getChar(CharSequence name, char defaultValue)
      Description copied from interface: Headers
      Returns the char value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getChar in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the char value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to char.
    • getShort

      public Short getShort(CharSequence name)
      Description copied from interface: Headers
      Returns the short value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getShort in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the short value of the first value in insertion order or null if there is no such value or it can't be converted to short.
    • getShort

      public short getShort(CharSequence name, short defaultValue)
      Description copied from interface: Headers
      Returns the short value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getShort in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the short value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to short.
    • getInt

      public Integer getInt(CharSequence name)
      Description copied from interface: Headers
      Returns the int value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getInt in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the int value of the first value in insertion order or null if there is no such value or it can't be converted to int.
    • getInt

      public int getInt(CharSequence name, int defaultValue)
      Description copied from interface: Headers
      Returns the int value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getInt in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the int value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to int.
    • getLong

      public Long getLong(CharSequence name)
      Description copied from interface: Headers
      Returns the long value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getLong in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the long value of the first value in insertion order or null if there is no such value or it can't be converted to long.
    • getLong

      public long getLong(CharSequence name, long defaultValue)
      Description copied from interface: Headers
      Returns the long value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getLong in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the long value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to long.
    • getFloat

      public Float getFloat(CharSequence name)
      Description copied from interface: Headers
      Returns the float value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getFloat in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the float value of the first value in insertion order or null if there is no such value or it can't be converted to float.
    • getFloat

      public float getFloat(CharSequence name, float defaultValue)
      Description copied from interface: Headers
      Returns the float value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getFloat in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the float value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to float.
    • getDouble

      public Double getDouble(CharSequence name)
      Description copied from interface: Headers
      Returns the double value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getDouble in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the double value of the first value in insertion order or null if there is no such value or it can't be converted to double.
    • getDouble

      public double getDouble(CharSequence name, double defaultValue)
      Description copied from interface: Headers
      Returns the double value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getDouble in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the double value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to double.
    • getTimeMillis

      public Long getTimeMillis(CharSequence name)
      Description copied from interface: Headers
      Returns the value of a header with the specified name in milliseconds. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getTimeMillis in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the milliseconds value of the first value in insertion order or null if there is no such value or it can't be converted to milliseconds.
    • getTimeMillis

      public long getTimeMillis(CharSequence name, long defaultValue)
      Description copied from interface: Headers
      Returns the value of a header with the specified name in milliseconds. If there is more than one value for the specified name, the first value in insertion order is returned.
      Specified by:
      getTimeMillis in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the milliseconds value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to milliseconds.
    • getBooleanAndRemove

      public Boolean getBooleanAndRemove(CharSequence name)
      Description copied from interface: Headers
      Returns the boolean value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getBooleanAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the boolean value of the first value in insertion order or null if there is no such value or it can't be converted to boolean.
    • getBooleanAndRemove

      public boolean getBooleanAndRemove(CharSequence name, boolean defaultValue)
      Description copied from interface: Headers
      Returns the boolean value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getBooleanAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the boolean value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to boolean.
    • getByteAndRemove

      public Byte getByteAndRemove(CharSequence name)
      Description copied from interface: Headers
      Returns the byte value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getByteAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      Returns:
      the byte value of the first value in insertion order or null if there is no such value or it can't be converted to byte.
    • getByteAndRemove

      public byte getByteAndRemove(CharSequence name, byte defaultValue)
      Description copied from interface: Headers
      Returns the byte value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getByteAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the byte value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to byte.
    • getCharAndRemove

      public Character getCharAndRemove(CharSequence name)
      Description copied from interface: Headers
      Returns the char value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getCharAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      Returns:
      the char value of the first value in insertion order or null if there is no such value or it can't be converted to char.
    • getCharAndRemove

      public char getCharAndRemove(CharSequence name, char defaultValue)
      Description copied from interface: Headers
      Returns the char value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getCharAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the char value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to char.
    • getShortAndRemove

      public Short getShortAndRemove(CharSequence name)
      Description copied from interface: Headers
      Returns the short value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getShortAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      Returns:
      the short value of the first value in insertion order or null if there is no such value or it can't be converted to short.
    • getShortAndRemove

      public short getShortAndRemove(CharSequence name, short defaultValue)
      Description copied from interface: Headers
      Returns the short value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getShortAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the short value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to short.
    • getIntAndRemove

      public Integer getIntAndRemove(CharSequence name)
      Description copied from interface: Headers
      Returns the int value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getIntAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      Returns:
      the int value of the first value in insertion order or null if there is no such value or it can't be converted to int.
    • getIntAndRemove

      public int getIntAndRemove(CharSequence name, int defaultValue)
      Description copied from interface: Headers
      Returns the int value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getIntAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the int value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to int.
    • getLongAndRemove

      public Long getLongAndRemove(CharSequence name)
      Description copied from interface: Headers
      Returns the long value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getLongAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      Returns:
      the long value of the first value in insertion order or null if there is no such value or it can't be converted to long.
    • getLongAndRemove

      public long getLongAndRemove(CharSequence name, long defaultValue)
      Description copied from interface: Headers
      Returns the long value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getLongAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the long value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to long.
    • getFloatAndRemove

      public Float getFloatAndRemove(CharSequence name)
      Description copied from interface: Headers
      Returns the float value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getFloatAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      Returns:
      the float value of the first value in insertion order or null if there is no such value or it can't be converted to float.
    • getFloatAndRemove

      public float getFloatAndRemove(CharSequence name, float defaultValue)
      Description copied from interface: Headers
      Returns the float value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getFloatAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the float value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to float.
    • getDoubleAndRemove

      public Double getDoubleAndRemove(CharSequence name)
      Description copied from interface: Headers
      Returns the double value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getDoubleAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      Returns:
      the double value of the first value in insertion order or null if there is no such value or it can't be converted to double.
    • getDoubleAndRemove

      public double getDoubleAndRemove(CharSequence name, double defaultValue)
      Description copied from interface: Headers
      Returns the double value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getDoubleAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the double value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to double.
    • getTimeMillisAndRemove

      public Long getTimeMillisAndRemove(CharSequence name)
      Description copied from interface: Headers
      Returns the value of a header with the specified name in milliseconds and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getTimeMillisAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the milliseconds value of the first value in insertion order or null if there is no such value or it can't be converted to milliseconds.
    • getTimeMillisAndRemove

      public long getTimeMillisAndRemove(CharSequence name, long defaultValue)
      Description copied from interface: Headers
      Returns the value of a header with the specified name in milliseconds and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Specified by:
      getTimeMillisAndRemove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the milliseconds value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to milliseconds.
    • contains

      public boolean contains(CharSequence name)
      Description copied from interface: Headers
      Returns true if a header with the name exists, false otherwise.
      Specified by:
      contains in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
    • contains

      public boolean contains(CharSequence name, CharSequence value)
      Description copied from interface: Headers
      Returns true if a header with the name and value exists, false otherwise.

      The Object.equals(Object) method is used to test for equality of value.

      Specified by:
      contains in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the header value of the header to find
    • containsObject

      public boolean containsObject(CharSequence name, Object value)
      Description copied from interface: Headers
      Returns true if a header with the name and value exists.
      Specified by:
      containsObject in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsBoolean

      public boolean containsBoolean(CharSequence name, boolean value)
      Description copied from interface: Headers
      Returns true if a header with the name and value exists.
      Specified by:
      containsBoolean in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsByte

      public boolean containsByte(CharSequence name, byte value)
      Description copied from interface: Headers
      Returns true if a header with the name and value exists.
      Specified by:
      containsByte in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsChar

      public boolean containsChar(CharSequence name, char value)
      Description copied from interface: Headers
      Returns true if a header with the name and value exists.
      Specified by:
      containsChar in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsShort

      public boolean containsShort(CharSequence name, short value)
      Description copied from interface: Headers
      Returns true if a header with the name and value exists.
      Specified by:
      containsShort in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsInt

      public boolean containsInt(CharSequence name, int value)
      Description copied from interface: Headers
      Returns true if a header with the name and value exists.
      Specified by:
      containsInt in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsLong

      public boolean containsLong(CharSequence name, long value)
      Description copied from interface: Headers
      Returns true if a header with the name and value exists.
      Specified by:
      containsLong in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsFloat

      public boolean containsFloat(CharSequence name, float value)
      Description copied from interface: Headers
      Returns true if a header with the name and value exists.
      Specified by:
      containsFloat in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsDouble

      public boolean containsDouble(CharSequence name, double value)
      Description copied from interface: Headers
      Returns true if a header with the name and value exists.
      Specified by:
      containsDouble in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsTimeMillis

      public boolean containsTimeMillis(CharSequence name, long value)
      Description copied from interface: Headers
      Returns true if a header with the name and value exists.
      Specified by:
      containsTimeMillis in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • size

      public int size()
      Description copied from interface: Headers
      Returns the number of headers in this object.
      Specified by:
      size in interface Headers<CharSequence,CharSequence,Http2Headers>
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Headers
      Returns true if Headers.size() equals 0.
      Specified by:
      isEmpty in interface Headers<CharSequence,CharSequence,Http2Headers>
    • names

      public Set<CharSequence> names()
      Description copied from interface: Headers
      Returns a Set of all header names in this object. The returned Set cannot be modified.
      Specified by:
      names in interface Headers<CharSequence,CharSequence,Http2Headers>
    • add

      public Http2Headers add(CharSequence name, CharSequence value)
      Description copied from interface: Headers
      Adds a new header with the specified name and value.
      Specified by:
      add in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the name of the header
      value - the value of the header
      Returns:
      this
    • add

      public Http2Headers add(CharSequence name, Iterable<? extends CharSequence> values)
      Description copied from interface: Headers
      Adds new headers with the specified name and values. This method is semantically equivalent to
       for (T value : values) {
           headers.add(name, value);
       }
       
      Specified by:
      add in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      values - the values of the header
      Returns:
      this
    • add

      public Http2Headers add(CharSequence name, CharSequence... values)
      Description copied from interface: Headers
      Adds new headers with the specified name and values. This method is semantically equivalent to
       for (T value : values) {
           headers.add(name, value);
       }
       
      Specified by:
      add in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      values - the values of the header
      Returns:
      this
    • addObject

      public Http2Headers addObject(CharSequence name, Object value)
      Description copied from interface: Headers
      Adds a new header. Before the value is added, it's converted to type T.
      Specified by:
      addObject in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addObject

      public Http2Headers addObject(CharSequence name, Iterable<?> values)
      Description copied from interface: Headers
      Adds a new header with the specified name and values. This method is equivalent to
       for (Object v : values) {
           headers.addObject(name, v);
       }
       
      Specified by:
      addObject in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      values - the value of the header
      Returns:
      this
    • addObject

      public Http2Headers addObject(CharSequence name, Object... values)
      Description copied from interface: Headers
      Adds a new header with the specified name and values. This method is equivalent to
       for (Object v : values) {
           headers.addObject(name, v);
       }
       
      Specified by:
      addObject in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      values - the value of the header
      Returns:
      this
    • addBoolean

      public Http2Headers addBoolean(CharSequence name, boolean value)
      Description copied from interface: Headers
      Adds a new header.
      Specified by:
      addBoolean in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addByte

      public Http2Headers addByte(CharSequence name, byte value)
      Description copied from interface: Headers
      Adds a new header.
      Specified by:
      addByte in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addChar

      public Http2Headers addChar(CharSequence name, char value)
      Description copied from interface: Headers
      Adds a new header.
      Specified by:
      addChar in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addShort

      public Http2Headers addShort(CharSequence name, short value)
      Description copied from interface: Headers
      Adds a new header.
      Specified by:
      addShort in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addInt

      public Http2Headers addInt(CharSequence name, int value)
      Description copied from interface: Headers
      Adds a new header.
      Specified by:
      addInt in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addLong

      public Http2Headers addLong(CharSequence name, long value)
      Description copied from interface: Headers
      Adds a new header.
      Specified by:
      addLong in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addFloat

      public Http2Headers addFloat(CharSequence name, float value)
      Description copied from interface: Headers
      Adds a new header.
      Specified by:
      addFloat in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addDouble

      public Http2Headers addDouble(CharSequence name, double value)
      Description copied from interface: Headers
      Adds a new header.
      Specified by:
      addDouble in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addTimeMillis

      public Http2Headers addTimeMillis(CharSequence name, long value)
      Description copied from interface: Headers
      Adds a new header.
      Specified by:
      addTimeMillis in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • add

      public Http2Headers add(Headers<? extends CharSequence,? extends CharSequence,?> headers)
      Description copied from interface: Headers
      Adds all header names and values of headers to this object.
      Specified by:
      add in interface Headers<CharSequence,CharSequence,Http2Headers>
      Returns:
      this
    • set

      public Http2Headers set(CharSequence name, CharSequence value)
      Description copied from interface: Headers
      Sets a header with the specified name and value. Any existing headers with the same name are overwritten.
      Specified by:
      set in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • set

      public Http2Headers set(CharSequence name, Iterable<? extends CharSequence> values)
      Description copied from interface: Headers
      Sets a new header with the specified name and values. This method is equivalent to
       for (T v : values) {
           headers.addObject(name, v);
       }
       
      Specified by:
      set in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      values - the value of the header
      Returns:
      this
    • set

      public Http2Headers set(CharSequence name, CharSequence... values)
      Description copied from interface: Headers
      Sets a header with the specified name and values. Any existing headers with this name are removed. This method is equivalent to:
       headers.remove(name);
       for (T v : values) {
           headers.add(name, v);
       }
       
      Specified by:
      set in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      values - the value of the header
      Returns:
      this
    • setObject

      public Http2Headers setObject(CharSequence name, Object value)
      Description copied from interface: Headers
      Sets a new header. Any existing headers with this name are removed. Before the value is add, it's converted to type T.
      Specified by:
      setObject in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • setObject

      public Http2Headers setObject(CharSequence name, Iterable<?> values)
      Description copied from interface: Headers
      Sets a header with the specified name and values. Any existing headers with this name are removed. This method is equivalent to:
       headers.remove(name);
       for (Object v : values) {
           headers.addObject(name, v);
       }
       
      Specified by:
      setObject in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      values - the values of the header
      Returns:
      this
    • setObject

      public Http2Headers setObject(CharSequence name, Object... values)
      Description copied from interface: Headers
      Sets a header with the specified name and values. Any existing headers with this name are removed. This method is equivalent to:
       headers.remove(name);
       for (Object v : values) {
           headers.addObject(name, v);
       }
       
      Specified by:
      setObject in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      values - the values of the header
      Returns:
      this
    • setBoolean

      public Http2Headers setBoolean(CharSequence name, boolean value)
      Description copied from interface: Headers
      Set the name to value. This will remove all previous values associated with name.
      Specified by:
      setBoolean in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setByte

      public Http2Headers setByte(CharSequence name, byte value)
      Description copied from interface: Headers
      Set the name to value. This will remove all previous values associated with name.
      Specified by:
      setByte in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setChar

      public Http2Headers setChar(CharSequence name, char value)
      Description copied from interface: Headers
      Set the name to value. This will remove all previous values associated with name.
      Specified by:
      setChar in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setShort

      public Http2Headers setShort(CharSequence name, short value)
      Description copied from interface: Headers
      Set the name to value. This will remove all previous values associated with name.
      Specified by:
      setShort in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setInt

      public Http2Headers setInt(CharSequence name, int value)
      Description copied from interface: Headers
      Set the name to value. This will remove all previous values associated with name.
      Specified by:
      setInt in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setLong

      public Http2Headers setLong(CharSequence name, long value)
      Description copied from interface: Headers
      Set the name to value. This will remove all previous values associated with name.
      Specified by:
      setLong in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setFloat

      public Http2Headers setFloat(CharSequence name, float value)
      Description copied from interface: Headers
      Set the name to value. This will remove all previous values associated with name.
      Specified by:
      setFloat in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setDouble

      public Http2Headers setDouble(CharSequence name, double value)
      Description copied from interface: Headers
      Set the name to value. This will remove all previous values associated with name.
      Specified by:
      setDouble in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setTimeMillis

      public Http2Headers setTimeMillis(CharSequence name, long value)
      Description copied from interface: Headers
      Set the name to value. This will remove all previous values associated with name.
      Specified by:
      setTimeMillis in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • set

      public Http2Headers set(Headers<? extends CharSequence,? extends CharSequence,?> headers)
      Description copied from interface: Headers
      Clears the current header entries and copies all header entries of the specified headers.
      Specified by:
      set in interface Headers<CharSequence,CharSequence,Http2Headers>
      Returns:
      this
    • setAll

      public Http2Headers setAll(Headers<? extends CharSequence,? extends CharSequence,?> headers)
      Description copied from interface: Headers
      Retains all current headers but calls Headers.set(K, V) for each entry in headers.
      Specified by:
      setAll in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      headers - The headers used to Headers.set(K, V) values in this instance
      Returns:
      this
    • remove

      public boolean remove(CharSequence name)
      Description copied from interface: Headers
      Removes all headers with the specified name.
      Specified by:
      remove in interface Headers<CharSequence,CharSequence,Http2Headers>
      Parameters:
      name - the header name
      Returns:
      true if at least one entry has been removed.
    • clear

      public Http2Headers clear()
      Description copied from interface: Headers
      Removes all headers. After a call to this method Headers.size() equals 0.
      Specified by:
      clear in interface Headers<CharSequence,CharSequence,Http2Headers>
      Returns:
      this
    • iterator

      Description copied from interface: Http2Headers
      Returns an iterator over all HTTP/2 headers. The iteration order is as follows: 1. All pseudo headers (order not specified). 2. All non-pseudo headers (in insertion order).
      Specified by:
      iterator in interface Headers<CharSequence,CharSequence,Http2Headers>
      Specified by:
      iterator in interface Http2Headers
      Specified by:
      iterator in interface Iterable<Map.Entry<CharSequence,CharSequence>>
    • valueIterator

      public Iterator<CharSequence> valueIterator(CharSequence name)
      Description copied from interface: Http2Headers
      Equivalent to Headers.getAll(Object) but no intermediate list is generated.
      Specified by:
      valueIterator in interface Http2Headers
      Parameters:
      name - the name of the header to retrieve
      Returns:
      an Iterator of header values corresponding to name.
    • method

      public Http2Headers method(CharSequence value)
      Description copied from interface: Http2Headers
      Specified by:
      method in interface Http2Headers
    • scheme

      public Http2Headers scheme(CharSequence value)
      Description copied from interface: Http2Headers
      Specified by:
      scheme in interface Http2Headers
    • authority

      public Http2Headers authority(CharSequence value)
      Description copied from interface: Http2Headers
      Specified by:
      authority in interface Http2Headers
    • path

      public Http2Headers path(CharSequence value)
      Description copied from interface: Http2Headers
      Specified by:
      path in interface Http2Headers
    • status

      public Http2Headers status(CharSequence value)
      Description copied from interface: Http2Headers
      Specified by:
      status in interface Http2Headers
    • method

      public CharSequence method()
      Description copied from interface: Http2Headers
      Gets the Http2Headers.PseudoHeaderName.METHOD header or null if there is no such header
      Specified by:
      method in interface Http2Headers
    • scheme

      public CharSequence scheme()
      Description copied from interface: Http2Headers
      Gets the Http2Headers.PseudoHeaderName.SCHEME header or null if there is no such header
      Specified by:
      scheme in interface Http2Headers
    • authority

      public CharSequence authority()
      Description copied from interface: Http2Headers
      Gets the Http2Headers.PseudoHeaderName.AUTHORITY header or null if there is no such header
      Specified by:
      authority in interface Http2Headers
    • path

      public CharSequence path()
      Description copied from interface: Http2Headers
      Gets the Http2Headers.PseudoHeaderName.PATH header or null if there is no such header
      Specified by:
      path in interface Http2Headers
    • status

      public CharSequence status()
      Description copied from interface: Http2Headers
      Gets the Http2Headers.PseudoHeaderName.STATUS header or null if there is no such header
      Specified by:
      status in interface Http2Headers
    • contains

      public boolean contains(CharSequence name, CharSequence value, boolean caseInsensitive)
      Description copied from interface: Http2Headers
      Returns true if a header with the name and value exists, false otherwise.

      If caseInsensitive is true then a case insensitive compare is done on the value.

      Specified by:
      contains in interface Http2Headers
      Parameters:
      name - the name of the header to find
      value - the value of the header to find
      caseInsensitive - true then a case insensitive compare is run to compare values. otherwise a case sensitive compare is run to compare values.
    • contains

      private static boolean contains(CharSequence name, int nameHash, CharSequence value, int valueHash, HashingStrategy<CharSequence> hashingStrategy, AsciiString[] headers)
    • toString

      public String toString()
      Overrides:
      toString in class Object