Enum Class Opcode
- All Implemented Interfaces:
Serializable,Comparable<Opcode>,Constable
Enumeration representing WebSocket opcodes along with their integer values.
These opcodes are defined in the WebSocket protocol.
- 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 -
Method Summary
Modifier and TypeMethodDescriptionbyteRetrieves the byte value of the opcode.static OpcodefromByte(byte controlByte) Retrieves the opcode corresponding to the given byte value.static OpcodefromInt(int controlByte) Retrieves the opcode corresponding to the given integer value.intintValue()Retrieves the integer value of the opcode.booleanChecks if the opcode is a code which should contain control instructionbooleanChecks if the opcode is a code which should contain databooleanChecks if the opcode is not a valid opcode as defined in RFC 6455static OpcodeReturns the enum constant of this class with the specified name.static Opcode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CONTINUATION
Indicates a continuation frame. -
TEXT
Indicates a text frame. -
BINARY
Indicates a binary frame. -
PING
Indicates a Ping frame. -
PONG
Indicates a Pong frame. -
CLOSE
Indicates a Close frame. -
UNKNOWN
Indicates that an opcode is unknown.
-
-
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
-
intValue
public int intValue()Retrieves the integer value of the opcode.- Returns:
- The integer value representing the opcode.
-
byteValue
public byte byteValue()Retrieves the byte value of the opcode.- Returns:
- The byte value representing the opcode.
-
isDataCode
public boolean isDataCode()Checks if the opcode is a code which should contain data- Returns:
- true if is a data code, false otherwise
-
isControlCode
public boolean isControlCode()Checks if the opcode is a code which should contain control instruction- Returns:
- true if is a control code, false otherwise
-
isUnknown
public boolean isUnknown()Checks if the opcode is not a valid opcode as defined in RFC 6455- Returns:
trueif the opcode is defined,falseotherwise
-
fromInt
Retrieves the opcode corresponding to the given integer value.- Parameters:
controlByte- The integer value of the opcode.- Returns:
- The ControlByte corresponding to the integer value, or null if not found.
-
fromByte
Retrieves the opcode corresponding to the given byte value.- Parameters:
controlByte- The byte value of the opcode.- Returns:
- The ControlByte corresponding to the byte value, or null if not found.
-