Enum FrameType

java.lang.Object
java.lang.Enum<FrameType>
org.simpleframework.http.socket.FrameType
All Implemented Interfaces:
Serializable, Comparable<FrameType>, java.lang.constant.Constable

public enum FrameType extends Enum<FrameType>
The FrameType represents the set of opcodes defined in RFC 6455. The base framing protocol uses a opcode to define the interpretation of the payload data for the frame.
See Also:
  • 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
    A binary frame identifies a message that contains binary data.
    A close frame identifies a frame used to terminate a connection.
    A continuation frame identifies a fragment from a larger message.
    A ping frame is a heartbeat used to determine connection health.
    A pong frame is sent is sent in response to a ping frame.
    A text frame identifies a message that contains UTF-8 text data.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    This is the integer value for the opcode.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    FrameType(int code)
    Constructor for the Frame type enumeration.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    This is used to determine if a frame is a close frame.
    boolean
    This is used to determine if a frame is a ping frame.
    boolean
    This is used to determine if a frame is a pong frame.
    boolean
    This is used to determine if a frame is a text frame.
    static FrameType
    resolveType(int octet)
    This is used to acquire the frame type given an opcode.
    static FrameType
    Returns the enum constant of this type with the specified name.
    static FrameType[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

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

    • CONTINUATION

      public static final FrameType CONTINUATION
      A continuation frame identifies a fragment from a larger message.
    • TEXT

      public static final FrameType TEXT
      A text frame identifies a message that contains UTF-8 text data.
    • BINARY

      public static final FrameType BINARY
      A binary frame identifies a message that contains binary data.
    • CLOSE

      public static final FrameType CLOSE
      A close frame identifies a frame used to terminate a connection.
    • PING

      public static final FrameType PING
      A ping frame is a heartbeat used to determine connection health.
    • PONG

      public static final FrameType PONG
      A pong frame is sent is sent in response to a ping frame.
  • Field Details

    • code

      public final int code
      This is the integer value for the opcode.
  • Constructor Details

    • FrameType

      private FrameType(int code)
      Constructor for the Frame type enumeration. This is given the opcode that is used to identify a specific frame type.
      Parameters:
      code - this is the opcode representing the frame type
  • Method Details

    • values

      public static FrameType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static FrameType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
      NullPointerException - if the argument is null
    • isText

      public boolean isText()
      This is used to determine if a frame is a text frame. It can be useful to know if a frame is a user based frame as it reduces the need to convert from or to certain character sets.
      Returns:
      this returns true if the frame represents a text frame
    • isClose

      public boolean isClose()
      This is used to determine if a frame is a close frame. A close frame contains an optional payload, which if present contains an error code in network byte order in the first two bytes, followed by an optional UTF-8 text reason of the closure.
      Returns:
      this returns true if the frame represents a close frame
    • isPong

      public boolean isPong()
      This is used to determine if a frame is a pong frame. A pong frame is sent in response to a ping and is used to determine if a WebSocket connection is still active and healthy.
      Returns:
      this returns true if the frame represents a pong frame
    • isPing

      public boolean isPing()
      This is used to determine if a frame is a ping frame. A ping frame is sent to check if a WebSocket connection is still healthy. A connection is determined healthy if it responds with a pong frame is a reasonable length of time.
      Returns:
      this returns true if the frame represents a ping frame
    • resolveType

      public static FrameType resolveType(int octet)
      This is used to acquire the frame type given an opcode. If no frame type can be determined from the opcode provided then this will return a null value.
      Parameters:
      octet - this is the octet representing the opcode
      Returns:
      this returns the frame type from the opcode