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

# Class EncodeException

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

All Implemented Interfaces:
  `Serializable`

public class EncodeException extends Exception
Exception thrown when an encoder fails to encode an object as a WebSocket message.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `EncodeException(Object object, String message)`
  Creates an EncodeException with the specified object and detail message.
  `EncodeException(Object object, String message, Throwable cause)`
  Creates an EncodeException with the specified object, detail message, and cause.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `getObject()`
  Returns the object that could not be encoded.

  ### 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

  - ### EncodeException

    public EncodeException(Object object, String message)
    Creates an EncodeException with the specified object and detail message.
    Parameters:
      `object` - The object that could not be encoded
      `message` - The detail message

  - ### EncodeException

    public EncodeException(Object object, String message, Throwable cause)
    Creates an EncodeException with the specified object, detail message, and cause.
    Parameters:
      `object` - The object that could not be encoded
      `message` - The detail message
      `cause` - The underlying cause of the exception

- ## Method Details

  - ### getObject

    public Object getObject()
    Returns the object that could not be encoded.
    Returns:
      The object that could not be encoded