Interface Frame

All Known Implementing Classes:
Frame.Continuation, Frame.Data, Frame.GoAway, Frame.Headers, Frame.Ping, Frame.Priority, Frame.PushPromise, Frame.RstStream, Frame.Settings, Frame.Unknown, Frame.WindowUpdate

One HTTP/2 frame (RFC 9113 §6). Instances are immutable apart from their byte arrays, which are not copied: whoever creates a frame hands its arrays over.

The constructors check only what any frame of the type must satisfy (ranges, required stream 0 or non-0), throwing IllegalArgumentException; rules about what the peer is allowed to send are checked by FrameReader and raised as Http2Exception.

padding on DATA, HEADERS and PUSH_PROMISE is the number of octets that padding adds to the frame, counting the Pad Length octet: 0 means the PADDED flag is clear, and n > 0 means a Pad Length of n - 1. It counts toward flow control for DATA.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    CONTINUATION (§6.10).
    static final record 
    DATA (§6.1): part of a stream's content.
    static final record 
    GOAWAY (§6.8).
    static final record 
    HEADERS (§6.2).
    static final record 
    PING (§6.7).
    static final record 
    PRIORITY (§6.3): parsed and otherwise ignored.
    static final record 
    The RFC 7540 priority signal carried by PRIORITY frames and HEADERS frames with the PRIORITY flag.
    static final record 
    PUSH_PROMISE (§6.6), with its complete field block.
    static final record 
    RST_STREAM (§6.4).
    static final record 
    SETTINGS (§6.5).
    static final record 
    A frame of a type this codec does not know (an extension).
    static final record 
    WINDOW_UPDATE (§6.9) for a stream, or for the connection when streamId is 0.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The largest stream identifier, 2^31 - 1.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    The stream this frame belongs to, or 0 for the connection.
    int
    The frame type code, one of the FrameType constants (or any value for Frame.Unknown).
  • Field Details

    • MAX_STREAM_ID

      static final int MAX_STREAM_ID
      The largest stream identifier, 2^31 - 1.
      See Also:
  • Method Details

    • streamId

      int streamId()
      The stream this frame belongs to, or 0 for the connection.
      Returns:
      the stream identifier, or 0 for the connection
    • type

      int type()
      The frame type code, one of the FrameType constants (or any value for Frame.Unknown).
      Returns:
      the unsigned frame type code