Class QuicDatagram

java.lang.Object
org.microproxy.quic.QuicDatagram

public final class QuicDatagram extends Object
One datagram's payload (RFC 9221) of an intercepted QUIC connection, as a QuicInterceptor sees it.
  • Constructor Summary

    Constructors
    Constructor
    Description
    QuicDatagram(byte[] data, boolean fromClient, Instant timestamp)
    A datagram.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    The payload as received.
    boolean
    Returns whether the client sent the datagram (going to the server), rather than the server.
    int
    Returns the number of bytes.
    The payload decoded as UTF-8, malformed sequences replaced with U+FFFD.
    Returns when the proxy received the datagram.
     
    withData(byte[] data)
    A copy of this datagram with another payload, the same direction and timestamp.

    Methods inherited from class java.lang.Object

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

    • QuicDatagram

      public QuicDatagram(byte[] data, boolean fromClient, Instant timestamp)
      A datagram.
      Parameters:
      data - the payload, which the datagram holds as it is (not copied)
      fromClient - whether the client sent it, rather than the server
      timestamp - when the proxy received it
  • Method Details

    • data

      public byte[] data()
      The payload as received. The array is the datagram's own, not a copy: an interceptor may change it in place and return it.
      Returns:
      the payload
    • length

      public int length()
      Returns the number of bytes.
      Returns:
      the number of bytes
    • fromClient

      public boolean fromClient()
      Returns whether the client sent the datagram (going to the server), rather than the server.
      Returns:
      whether the client sent the datagram (going to the server), rather than the server
    • timestamp

      public Instant timestamp()
      Returns when the proxy received the datagram.
      Returns:
      when the proxy received the datagram
    • text

      public String text()
      The payload decoded as UTF-8, malformed sequences replaced with U+FFFD.
      Returns:
      the text
    • withData

      public QuicDatagram withData(byte[] data)
      A copy of this datagram with another payload, the same direction and timestamp.
      Parameters:
      data - the payload of the copy (not copied)
      Returns:
      the copy
    • toString

      public String toString()
      Overrides:
      toString in class Object