Record Class StreamId

java.lang.Object
java.lang.Record
io.github.mahmoudimus.quic.connection.StreamId
Record Components:
value - the 62-bit stream ID as sent on the wire
All Implemented Interfaces:
Comparable<StreamId>

public record StreamId(long value) extends Record implements Comparable<StreamId>
A stream ID (RFC 9000 section 2.1): the two low bits give the initiator and direction, the rest the stream's index among the streams of that type.
  • Constructor Summary

    Constructors
    Constructor
    Description
    StreamId(long value)
    A stream ID.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    dir()
    The stream's directionality.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    long
    The stream's index among streams of its type.
    The side that opened the stream.
    static StreamId
    of(Side initiator, Dir dir, long index)
    The stream ID of a stream type and index.
    As in client bidirectional stream 0.
    long
    Returns the value of the value record component.

    Methods inherited from class java.lang.Object

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

    • StreamId

      public StreamId(long value)
      A stream ID.
      Parameters:
      value - 0 to 262-1
  • Method Details

    • of

      public static StreamId of(Side initiator, Dir dir, long index)
      The stream ID of a stream type and index.
      Parameters:
      initiator - the side that opens the stream
      dir - the stream's directionality
      index - the stream's index among streams of its type, below 260
      Returns:
      the stream ID
    • initiator

      public Side initiator()
      The side that opened the stream.
      Returns:
      the initiator
    • dir

      public Dir dir()
      The stream's directionality.
      Returns:
      Dir.BI or Dir.UNI
    • index

      public long index()
      The stream's index among streams of its type.
      Returns:
      the index
    • compareTo

      public int compareTo(StreamId o)
      Specified by:
      compareTo in interface Comparable<StreamId>
    • toString

      public String toString()
      As in client bidirectional stream 0.
      Specified by:
      toString in class Record
    • 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. All components in this record class 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.
    • value

      public long value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component