Class FrameHeader

java.lang.Object
dev.relism.flash.http2.frame.FrameHeader

public final class FrameHeader extends Object
A flyweight over one frame's 9-byte header plus its payload location, both still living in Http2FrameReader's own read buffer. One instance per connection, reset(byte[], int) in place by every Http2FrameReader.readFrame() call — never allocated per frame (mirrors the existing WebSocketFrame reuse idiom in dev.relism.flash.websocket).

Lifetime contract

Valid only until the next Http2FrameReader.readFrame()/consumeFrame() call on the same reader — same "do not retain past the handler" rule the rest of this codebase's buffer-backed flyweights (`Http1HeaderMap`, `WebSocketFrame`) already document. The payload bytes are also transient: whatever layer needs to retain a DATA frame's payload past this window

Reserved bit and unknown types

streamId() has already had the wire's reserved high bit (RFC 9113 §4.1: "R: A reserved 1-bit field... The semantics of this bit are undefined, and the bit MUST be ignored when receiving") masked off during reset(byte[], int) — callers never see it and never need to mask it themselves. type() is null for a type code FrameType does not recognise (i.e. typeCode() > FrameType.maxKnown()); per RFC 9113 §4.1 such frames must be ignored, not rejected — typeCode() remains available so the caller can still log or count it before skipping the payload.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    The backing buffer — see the class Javadoc's lifetime contract before retaining a reference.
    int
    The raw flags byte — interpret via FrameFlags, which is type-specific.
    int
    Payload length in bytes, as declared by the frame header (0..2^24-1 before any limit check).
    int
    Offset of the first payload byte within buffer().
    int
    Stream identifier, reserved bit already masked.
    The recognised frame type, or null if typeCode() is not one of RFC 9113's 10.
    int
    The raw wire type byte, valid even when type() is null (an unrecognised type).

    Methods inherited from class java.lang.Object

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

    • FrameHeader

      public FrameHeader()
  • Method Details

    • length

      public int length()
      Payload length in bytes, as declared by the frame header (0..2^24-1 before any limit check).
    • typeCode

      public int typeCode()
      The raw wire type byte, valid even when type() is null (an unrecognised type).
    • type

      public FrameType type()
      The recognised frame type, or null if typeCode() is not one of RFC 9113's 10.
    • flags

      public int flags()
      The raw flags byte — interpret via FrameFlags, which is type-specific.
    • streamId

      public int streamId()
      Stream identifier, reserved bit already masked. 0 means "the connection itself".
    • buffer

      public byte[] buffer()
      The backing buffer — see the class Javadoc's lifetime contract before retaining a reference.
    • payloadOffset

      public int payloadOffset()
      Offset of the first payload byte within buffer(). Payload spans [payloadOffset(), payloadOffset() + length()).