Record Class HeaderField

java.lang.Object
java.lang.Record
io.github.mahmoudimus.http3.HeaderField
Record Components:
name - the field name, one char per octet
value - the field value, one char per octet
sensitive - the field was, or must be, sent as a literal with the 'N' (never-indexed) bit set (RFC 9204 §4.5.4): an intermediary must forward it as a literal with the bit set, so that it never enters a compression context

public record HeaderField(String name, String value, boolean sensitive) extends Record
One header or trailer field (a name and a value) as QPACK carries it. Names and values are octet strings; they are held as Strings with one char per octet (ISO-8859-1), so no input is lost and none is reinterpreted. Http3Headers checks which octets HTTP allows.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The per-entry overhead QPACK adds to the octet lengths of name and value (RFC 9204 §3.2.1).
  • Constructor Summary

    Constructors
    Constructor
    Description
    HeaderField(String name, String value)
    Creates a field that may enter a compression context.
    HeaderField(String name, String value, boolean sensitive)
    Creates a field.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the name record component.
    boolean
    Returns the value of the sensitive record component.
    int
    The size QPACK and SETTINGS_MAX_FIELD_SECTION_SIZE count for this field: name + value + 32.
    Returns a string representation of this record class.
    Returns the value of the value record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ENTRY_OVERHEAD

      public static final int ENTRY_OVERHEAD
      The per-entry overhead QPACK adds to the octet lengths of name and value (RFC 9204 §3.2.1).
      See Also:
  • Constructor Details

    • HeaderField

      public HeaderField(String name, String value, boolean sensitive)
      Creates a field.
      Parameters:
      name - the field name, one char per octet
      value - the field value, one char per octet
      sensitive - whether the field is sent as a never-indexed literal
    • HeaderField

      public HeaderField(String name, String value)
      Creates a field that may enter a compression context.
      Parameters:
      name - the field name, one char per octet
      value - the field value, one char per octet
  • Method Details

    • size

      public int size()
      The size QPACK and SETTINGS_MAX_FIELD_SECTION_SIZE count for this field: name + value + 32.
      Returns:
      the size in octets
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • value

      public String value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • sensitive

      public boolean sensitive()
      Returns the value of the sensitive record component.
      Returns:
      the value of the sensitive record component