Record Class HeaderLayout
java.lang.Object
java.lang.Record
io.github.mahmoudimus.quic.packet.HeaderLayout
- Record Components:
start- the index of the first header bytelengthOffset- the index of the two-byte Length field, or -1 for headers without onepacketNumberOffset- the index of the packet number, or -1 for unprotected packetspacketNumberLength- the packet number length, 1 to 4, or 0 for unprotected packetspayloadOffset- the index just past the header, where the payload starts
public record HeaderLayout(int start, int lengthOffset, int packetNumberOffset, int packetNumberLength, int payloadOffset)
extends Record
Where an encoded header's fields sit in the packet buffer, so that protection can fill in the
Length field and mask the packet number once the payload is written. All offsets are absolute
buffer indexes.
-
Constructor Summary
ConstructorsConstructorDescriptionHeaderLayout(int start, int lengthOffset, int packetNumberOffset, int packetNumberLength, int payloadOffset) Creates an instance of aHeaderLayoutrecord class. -
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.intThe header length.intReturns the value of thelengthOffsetrecord component.intReturns the value of thepacketNumberLengthrecord component.intReturns the value of thepacketNumberOffsetrecord component.intReturns the value of thepayloadOffsetrecord component.intstart()Returns the value of thestartrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
HeaderLayout
public HeaderLayout(int start, int lengthOffset, int packetNumberOffset, int packetNumberLength, int payloadOffset) Creates an instance of aHeaderLayoutrecord class.- Parameters:
start- the value for thestartrecord componentlengthOffset- the value for thelengthOffsetrecord componentpacketNumberOffset- the value for thepacketNumberOffsetrecord componentpacketNumberLength- the value for thepacketNumberLengthrecord componentpayloadOffset- the value for thepayloadOffsetrecord component
-
-
Method Details
-
headerLength
public int headerLength()The header length.- Returns:
payloadOffset - start
-
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. All components in this record class are compared with '=='. -
start
public int start()Returns the value of thestartrecord component.- Returns:
- the value of the
startrecord component
-
lengthOffset
public int lengthOffset()Returns the value of thelengthOffsetrecord component.- Returns:
- the value of the
lengthOffsetrecord component
-
packetNumberOffset
public int packetNumberOffset()Returns the value of thepacketNumberOffsetrecord component.- Returns:
- the value of the
packetNumberOffsetrecord component
-
packetNumberLength
public int packetNumberLength()Returns the value of thepacketNumberLengthrecord component.- Returns:
- the value of the
packetNumberLengthrecord component
-
payloadOffset
public int payloadOffset()Returns the value of thepayloadOffsetrecord component.- Returns:
- the value of the
payloadOffsetrecord component
-