Enum Class ClosureCode

java.lang.Object
java.lang.Enum<ClosureCode>
de.craftsblock.craftsnet.api.websocket.ClosureCode
All Implemented Interfaces:
Serializable, Comparable<ClosureCode>, Constable

public enum ClosureCode extends Enum<ClosureCode>
Enumeration representing WebSocket closure codes along with their integer values and internal status. These codes are defined in RFC 6455 (https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1).
Since:
3.0.5-SNAPSHOT
  • 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
    Indicates an abnormal closure, meaning that the connection was closed abruptly without sending or receiving a close frame.
    Indicates that the server is terminating the connection because it received a message that was too large.
    Indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page.
    Indicates that no status code was actually present.
    Indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.
    Indicates a violation of the WebSocket protocol's policy.
    Indicates a protocol error, meaning that the endpoint received a message that violates its protocol.
    Indicates that the server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
    Indicates that the service is terminating the connection because it is restarting.
    Indicates that the connection was closed due to a failure to perform a TLS handshake.
    Indicates that the message received was too large for the endpoint to process.
    Indicates that the service is terminating the connection because it encountered an error during the transmission of the response.
    Indicates that the received message type is unsupported or not expected.
    Indicates that the endpoint received a message with a payload that it cannot accept.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final List<ClosureCode>
    List of ClosureCode values that are considered internal.
    static final List<Integer>
    List of integer values corresponding to ClosureCode values that are considered internal.
    static final List<Integer>
    List of all closure codes that are specified in RFC 6455.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromInt(int code)
    Converts an int to the corresponding ClosureCode.
    int
    Retrieves the integer value of the ClosureCode.
    boolean
    Checks whether the ClosureCode is considered internal.
    Returns the enum constant of this class with the specified name.
    static ClosureCode[]
    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

    • NORMAL

      public static final ClosureCode NORMAL
      Indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.
    • GOING_AWAY

      public static final ClosureCode GOING_AWAY
      Indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page.
    • PROTOCOL_ERROR

      public static final ClosureCode PROTOCOL_ERROR
      Indicates a protocol error, meaning that the endpoint received a message that violates its protocol.
    • UNSUPPORTED

      public static final ClosureCode UNSUPPORTED
      Indicates that the received message type is unsupported or not expected.
    • NO_STATUS

      public static final ClosureCode NO_STATUS
      Indicates that no status code was actually present.
    • ABNORMAL

      public static final ClosureCode ABNORMAL
      Indicates an abnormal closure, meaning that the connection was closed abruptly without sending or receiving a close frame.
    • UNSUPPORTED_PAYLOAD

      public static final ClosureCode UNSUPPORTED_PAYLOAD
      Indicates that the endpoint received a message with a payload that it cannot accept.
    • POLICY_VIOLATION

      public static final ClosureCode POLICY_VIOLATION
      Indicates a violation of the WebSocket protocol's policy.
    • TOO_LARGE

      public static final ClosureCode TOO_LARGE
      Indicates that the message received was too large for the endpoint to process.
    • SERVER_ERROR

      public static final ClosureCode SERVER_ERROR
      Indicates that the server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
    • SERVICE_ERROR

      public static final ClosureCode SERVICE_ERROR
      Indicates that the service is terminating the connection because it is restarting.
    • TRY_AGAIN_LATER

      public static final ClosureCode TRY_AGAIN_LATER
      Indicates that the service is terminating the connection because it encountered an error during the transmission of the response.
    • BAD_GATEWAY

      public static final ClosureCode BAD_GATEWAY
      Indicates that the server is terminating the connection because it received a message that was too large.
    • TLS_HANDSHAKE_FAIL

      public static final ClosureCode TLS_HANDSHAKE_FAIL
      Indicates that the connection was closed due to a failure to perform a TLS handshake.
  • Field Details

    • SPECIFIED_CODES

      public static final List<Integer> SPECIFIED_CODES
      List of all closure codes that are specified in RFC 6455.
      Since:
      3.4.0-SNAPSHOT
    • INTERNAL_CODES

      public static final List<ClosureCode> INTERNAL_CODES
      List of ClosureCode values that are considered internal.
    • RAW_INTERNAL_CODES

      public static final List<Integer> RAW_INTERNAL_CODES
      List of integer values corresponding to ClosureCode values that are considered internal.
  • Method Details

    • values

      public static ClosureCode[] 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 ClosureCode 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
    • intValue

      public int intValue()
      Retrieves the integer value of the ClosureCode.
      Returns:
      The integer value representing the closure code.
    • isInternal

      public boolean isInternal()
      Checks whether the ClosureCode is considered internal.
      Returns:
      true if the ClosureCode is considered internal, otherwise false.
    • fromInt

      public static ClosureCode fromInt(int code)
      Converts an int to the corresponding ClosureCode.
      Parameters:
      code - The int which should be converted.
      Returns:
      The corresponding ClosureCode.