Record Class Http2Frame.Data

java.lang.Object
java.lang.Record
org.microproxy.frames.Http2Frame.Data
Record Components:
streamId - the stream
data - the content, not copied
endStream - whether the frame ends the stream
All Implemented Interfaces:
Http2Frame, HttpFrame
Enclosing interface:
Http2Frame

public static record Http2Frame.Data(int streamId, byte[] data, boolean endStream) extends Record implements Http2Frame
DATA (section 6.1). Interceptors see DATA frames of at most 16 KiB; padding is not shown (it is counted for flow control, and the proxy never sends any).
  • Constructor Details

    • Data

      public Data(int streamId, byte[] data, boolean endStream)
      Creates DATA.
      Parameters:
      streamId - the stream, 1 or more
      data - the content, not copied
      endStream - whether the frame ends the stream
  • Method Details

    • typeName

      public String typeName()
      Description copied from interface: HttpFrame
      The frame type's name as the protocol's RFC spells it (DATA, HEADERS, SETTINGS, ...), or UNKNOWN for an extension or reserved type.
      Specified by:
      typeName in interface HttpFrame
      Returns:
      the frame type name
    • typeCode

      public long typeCode()
      Description copied from interface: HttpFrame
      The frame type's code on the wire.
      Specified by:
      typeCode in interface HttpFrame
      Returns:
      the unsigned type code
    • text

      public String text()
      The content as UTF-8 text (malformed sequences replaced).
      Returns:
      the decoded content
    • withData

      public Http2Frame.Data withData(byte[] newData)
      This frame with other content.
      Parameters:
      newData - the new content
      Returns:
      a copy with newData
    • withText

      public Http2Frame.Data withText(String text)
      This frame with text, encoded as UTF-8, as its content.
      Parameters:
      text - the new content
      Returns:
      a copy with the text
    • withEndStream

      public Http2Frame.Data withEndStream(boolean end)
      This frame with END_STREAM set or not (see FrameInterceptor for who decides).
      Parameters:
      end - whether the frame ends the stream
      Returns:
      a copy with the flag
    • equals

      public boolean equals(Object o)
      Compares the content, not the array's identity.
      Specified by:
      equals in class Record
    • hashCode

      public 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
    • 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
    • streamId

      public int streamId()
      Returns the value of the streamId record component.
      Specified by:
      streamId in interface Http2Frame
      Returns:
      the value of the streamId record component
    • data

      public byte[] data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component
    • endStream

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