Package io.github.mahmoudimus.http2
Record Class HeaderField
java.lang.Object
java.lang.Record
io.github.mahmoudimus.http2.HeaderField
- Record Components:
name- the non-null field name as ISO-8859-1 octetsvalue- the non-null field value as ISO-8859-1 octetssensitive- the field was, or must be, sent as a never-indexed literal (RFC 7541 §6.2.3): an intermediary must re-encode it the same way so that it never enters a compression context
One header or trailer field (a name and a value) as HPACK 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.
Http2Headers checks which octets HTTP allows.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe per-entry overhead HPACK adds to the octet lengths of name and value (RFC 7541 §4.1). -
Constructor Summary
ConstructorsConstructorDescriptionHeaderField(String name, String value) Creates a field without an explicit never-indexed requirement.HeaderField(String name, String value, boolean sensitive) Creates a field with the given indexing sensitivity. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.booleanReturns the value of thesensitiverecord component.intsize()The size HPACK and SETTINGS_MAX_HEADER_LIST_SIZE count for this field: name + value + 32.toString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Field Details
-
ENTRY_OVERHEAD
public static final int ENTRY_OVERHEADThe per-entry overhead HPACK adds to the octet lengths of name and value (RFC 7541 §4.1).- See Also:
-
-
Constructor Details
-
HeaderField
Creates a field with the given indexing sensitivity.- Parameters:
name- the non-null field name as ISO-8859-1 octetsvalue- the non-null field value as ISO-8859-1 octetssensitive- whether intermediaries must preserve never-indexed encoding
-
HeaderField
Creates a field without an explicit never-indexed requirement.- Parameters:
name- the non-null field name as ISO-8859-1 octetsvalue- the non-null field value as ISO-8859-1 octets
-
-
Method Details
-
size
public int size()The size HPACK and SETTINGS_MAX_HEADER_LIST_SIZE count for this field: name + value + 32.- Returns:
- the field size in octets, including the 32-octet overhead
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
sensitive
public boolean sensitive()Returns the value of thesensitiverecord component.- Returns:
- the value of the
sensitiverecord component
-