Package dev.relism.flash.http2.frame
Class FrameHeader
java.lang.Object
dev.relism.flash.http2.frame.FrameHeader
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 nextHttp2FrameReader.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 -
Method Summary
Modifier and TypeMethodDescriptionbyte[]buffer()The backing buffer — see the class Javadoc's lifetime contract before retaining a reference.intflags()The raw flags byte — interpret viaFrameFlags, which is type-specific.intlength()Payload length in bytes, as declared by the frame header (0..2^24-1 before any limit check).intOffset of the first payload byte withinbuffer().intstreamId()Stream identifier, reserved bit already masked.type()The recognised frame type, ornulliftypeCode()is not one of RFC 9113's 10.inttypeCode()The raw wire type byte, valid even whentype()isnull(an unrecognised type).
-
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 whentype()isnull(an unrecognised type). -
type
The recognised frame type, ornulliftypeCode()is not one of RFC 9113's 10. -
flags
public int flags()The raw flags byte — interpret viaFrameFlags, which is type-specific. -
streamId
public int streamId()Stream identifier, reserved bit already masked.0means "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 withinbuffer(). Payload spans[payloadOffset(), payloadOffset() + length()).
-