Enum Class Http2ErrorCode

java.lang.Object
java.lang.Enum<Http2ErrorCode>
dev.relism.flash.http2.Http2ErrorCode
All Implemented Interfaces:
Serializable, Comparable<Http2ErrorCode>, Constable

public enum Http2ErrorCode extends Enum<Http2ErrorCode>
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 Constants
    Enum Constant
    Description
    Used 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 within SETTINGS_ACK_TIMEOUT_MS.
    A frame was received for a stream that is already closed.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    The pre-encoded 4-byte big-endian wire form.
    int
    The numeric error code as it appears on the wire.
    fromCode(int code)
    Decodes a 32-bit error code received from a peer.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • NO_ERROR

      public static final Http2ErrorCode NO_ERROR
      Graceful shutdown or successful completion; not an error. RFC 9113 §7.
    • PROTOCOL_ERROR

      public static final Http2ErrorCode PROTOCOL_ERROR
      The peer violated the protocol in a way not covered by a more specific code.
    • INTERNAL_ERROR

      public static final Http2ErrorCode INTERNAL_ERROR
      Unexpected internal condition on our side (e.g. an uncaught exception on the demux loop).
    • FLOW_CONTROL_ERROR

      public static final Http2ErrorCode FLOW_CONTROL_ERROR
      A flow-control window was violated: overflow past 2^31-1, or a peer exceeded its window.
    • SETTINGS_TIMEOUT

      public static final Http2ErrorCode SETTINGS_TIMEOUT
      The peer did not acknowledge our SETTINGS within SETTINGS_ACK_TIMEOUT_MS.
    • STREAM_CLOSED

      public static final Http2ErrorCode STREAM_CLOSED
      A frame was received for a stream that is already closed.
    • FRAME_SIZE_ERROR

      public static final Http2ErrorCode FRAME_SIZE_ERROR
      A frame's length did not match what its type requires (RFC 9113 §4.2, per-type rules).
    • REFUSED_STREAM

      public static final Http2ErrorCode REFUSED_STREAM
      The stream was refused before any processing; safe for the client to retry elsewhere.
    • CANCEL

      public static final Http2ErrorCode CANCEL
      Used by clients to cancel a stream; Flash never sends it, only receives it.
    • COMPRESSION_ERROR

      public static final Http2ErrorCode COMPRESSION_ERROR
      An HPACK decoding failure. Terminates the connection because the dynamic table state is lost.
    • CONNECT_ERROR

      public static final Http2ErrorCode CONNECT_ERROR
      A CONNECT-tunnelled stream failed.
    • ENHANCE_YOUR_CALM

      public static final Http2ErrorCode ENHANCE_YOUR_CALM
      The peer is generating excessive load (rate-limit rejection: Rapid Reset, PING/SETTINGS floods).
    • INADEQUATE_SECURITY

      public static final Http2ErrorCode INADEQUATE_SECURITY
      The negotiated TLS parameters fall below RFC 9113 §9.2's minimum security requirements.
    • HTTP_1_1_REQUIRED

      public static final Http2ErrorCode HTTP_1_1_REQUIRED
      Defined by RFC 9113 for HTTP/1.1-only resources; Flash serves everything over h2, so unused.
  • Method Details

    • values

      public static Http2ErrorCode[] 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

      public static Http2ErrorCode valueOf(String name)
      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 name
      NullPointerException - 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 a RST_STREAM or GOAWAY payload with a single System.arraycopy — never allocated or formatted per use.
    • fromCode

      public static Http2ErrorCode fromCode(int code)
      Decodes a 32-bit error code received from a peer. Returns null for 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.