DecodeException (WebSocket 2.2 API Documentation - Apache Tomcat 11.0.23)
Description: declaration: package: jakarta.websocket, class: DecodeException

# Class DecodeException

java.lang.Object
java.lang.Throwable
java.lang.Exception
jakarta.websocket.DecodeException

All Implemented Interfaces:
  `Serializable`

public class DecodeException extends Exception
Exception thrown when a decoder fails to decode a WebSocket message.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DecodeException(String encodedString, String message)`
  Creates a DecodeException for text data with the specified detail message.
  `DecodeException(String encodedString, String message, Throwable cause)`
  Creates a DecodeException for text data with the specified detail message and cause.
  `DecodeException(ByteBuffer bb, String message)`
  Creates a DecodeException for binary data with the specified detail message.
  `DecodeException(ByteBuffer bb, String message, Throwable cause)`
  Creates a DecodeException for binary data with the specified detail message and cause.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ByteBuffer`
  `getBytes()`
  Returns the binary data that could not be decoded.
  `String`
  `getText()`
  Returns the text data that could not be decoded.

  ### Methods inherited from class Throwable

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### DecodeException

    public DecodeException(ByteBuffer bb, String message, Throwable cause)
    Creates a DecodeException for binary data with the specified detail message and cause.
    Parameters:
      `bb` - The binary data that could not be decoded
      `message` - The detail message
      `cause` - The underlying cause of the exception

  - ### DecodeException

    public DecodeException(String encodedString, String message, Throwable cause)
    Creates a DecodeException for text data with the specified detail message and cause.
    Parameters:
      `encodedString` - The text data that could not be decoded
      `message` - The detail message
      `cause` - The underlying cause of the exception

  - ### DecodeException

    public DecodeException(ByteBuffer bb, String message)
    Creates a DecodeException for binary data with the specified detail message.
    Parameters:
      `bb` - The binary data that could not be decoded
      `message` - The detail message

  - ### DecodeException

    public DecodeException(String encodedString, String message)
    Creates a DecodeException for text data with the specified detail message.
    Parameters:
      `encodedString` - The text data that could not be decoded
      `message` - The detail message

- ## Method Details

  - ### getBytes

    public ByteBuffer getBytes()
    Returns the binary data that could not be decoded.
    Returns:
      The binary data, or `null` if the exception was for text data

  - ### getText

    public String getText()
    Returns the text data that could not be decoded.
    Returns:
      The text data, or `null` if the exception was for binary data