Package dev.relism.flash.http2
Enum Class Http2ErrorCode
- All Implemented Interfaces:
Serializable,Comparable<Http2ErrorCode>,Constable
The 14 HTTP/2 error codes defined by RFC 9113 §7.
Each constant carries its 4-byte big-endian wire encoding, precomputed once at class
load (RFC 9113 §6.4 RST_STREAM and §6.8 GOAWAY both carry the error code as
a raw 32-bit field — there is no framing around it to build). Callers write
Http2ErrorCode is used to reject a peer and to interpret what a peer
sends us: fromCode(int) decodes a received 32-bit value. RFC 9113 does not reserve
unknown codes for future use in a way that requires us to accept them silently as one of the
14 — an endpoint that receives an error code it does not recognise treats it as
INTERNAL_ERROR-equivalent for logging purposes; fromCode(int) returns
null for that case and callers log the raw integer rather than guessing a mapping.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionUsed by clients to cancel a stream; Flash never sends it, only receives it.An HPACK decoding failure.A CONNECT-tunnelled stream failed.The peer is generating excessive load (rate-limit rejection: Rapid Reset, PING/SETTINGS floods).A flow-control window was violated: overflow past 2^31-1, or a peer exceeded its window.A frame's length did not match what its type requires (RFC 9113 §4.2, per-type rules).Defined by RFC 9113 for HTTP/1.1-only resources; Flash serves everything over h2, so unused.The negotiated TLS parameters fall below RFC 9113 §9.2's minimum security requirements.Unexpected internal condition on our side (e.g. an uncaught exception on the demux loop).Graceful shutdown or successful completion; not an error.The peer violated the protocol in a way not covered by a more specific code.The stream was refused before any processing; safe for the client to retry elsewhere.The peer did not acknowledge our SETTINGS withinSETTINGS_ACK_TIMEOUT_MS.A frame was received for a stream that is already closed. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]bytes()The pre-encoded 4-byte big-endian wire form.intcode()The numeric error code as it appears on the wire.static Http2ErrorCodefromCode(int code) Decodes a 32-bit error code received from a peer.static Http2ErrorCodeReturns the enum constant of this class with the specified name.static Http2ErrorCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NO_ERROR
Graceful shutdown or successful completion; not an error. RFC 9113 §7. -
PROTOCOL_ERROR
The peer violated the protocol in a way not covered by a more specific code. -
INTERNAL_ERROR
Unexpected internal condition on our side (e.g. an uncaught exception on the demux loop). -
FLOW_CONTROL_ERROR
A flow-control window was violated: overflow past 2^31-1, or a peer exceeded its window. -
SETTINGS_TIMEOUT
The peer did not acknowledge our SETTINGS withinSETTINGS_ACK_TIMEOUT_MS. -
STREAM_CLOSED
A frame was received for a stream that is already closed. -
FRAME_SIZE_ERROR
A frame's length did not match what its type requires (RFC 9113 §4.2, per-type rules). -
REFUSED_STREAM
The stream was refused before any processing; safe for the client to retry elsewhere. -
CANCEL
Used by clients to cancel a stream; Flash never sends it, only receives it. -
COMPRESSION_ERROR
An HPACK decoding failure. Terminates the connection because the dynamic table state is lost. -
CONNECT_ERROR
A CONNECT-tunnelled stream failed. -
ENHANCE_YOUR_CALM
The peer is generating excessive load (rate-limit rejection: Rapid Reset, PING/SETTINGS floods). -
INADEQUATE_SECURITY
The negotiated TLS parameters fall below RFC 9113 §9.2's minimum security requirements. -
HTTP_1_1_REQUIRED
Defined by RFC 9113 for HTTP/1.1-only resources; Flash serves everything over h2, so unused.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
code
public int code()The numeric error code as it appears on the wire. -
bytes
public byte[] bytes()The pre-encoded 4-byte big-endian wire form. Safe to write directly into aRST_STREAMorGOAWAYpayload with a singleSystem.arraycopy— never allocated or formatted per use. -
fromCode
Decodes a 32-bit error code received from a peer. Returnsnullfor a value outside the 14 defined codes; the caller should log the raw integer rather than assume a mapping, since RFC 9113 permits future extension codes we do not yet know about.
-