Top Description Fields Constructors Methods
jakarta.websocket

public Class DecodeException

extends Exception
Class Inheritance
Imports
java.nio.ByteBuffer

A general exception that occurs when trying to decode a custom object from a text or binary message.
Author
dannycoward

Field Summary

Modifier and TypeField and Description
private final ByteBuffer
private final String
private static final long

Constructor Summary

AccessConstructor and Description
public
DecodeException(ByteBuffer
the byte buffer containing the (part of) the message that could not be decoded.
bb
,
String
the reason for the failure.
message
,
Throwable
the cause of the error.
cause
)

Constructor with the binary data that could not be decoded, and the reason why it failed to be, and the cause.

public
DecodeException(String
the string representing the (part of) the message that could not be decoded.
encodedString
,
String
the reason for the failure.
message
,
Throwable
the cause of the error.
cause
)

Constructor with the text data that could not be decoded, and the reason why it failed to be, and the cause.

public
DecodeException(ByteBuffer
the byte buffer containing the (part of) the message that could not be decoded.
bb
,
String
the reason for the failure.
message
)

Constructs a DecodedException with the given ByteBuffer that cannot be decoded, and reason why.

public
DecodeException(String
the string representing the (part of) the message that could not be decoded.
encodedString
,
String
the reason for the failure.
message
)

Constructs a DecodedException with the given encoded string that cannot be decoded, and reason why.

Method Summary

Modifier and TypeMethod and Description
public ByteBuffer

Returns:

the binary data not decoded or null for text message failures.
getBytes
()

Return the ByteBuffer containing either the whole message, or the partial message, that could not be decoded, or null if this exception arose from a failure to decode a text message.

public String

Returns:

the text not decoded or null for binary message failures.
getText
()

Return the encoded string that is either the whole message, or the partial message that could not be decoded, or null if this exception arose from a failure to decode a binary message..

Field Detail

bbback to summary
private final ByteBuffer bb
encodedStringback to summary
private final String encodedString
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Exception.serialVersionUID.

Constructor Detail

DecodeExceptionback to summary
public DecodeException(ByteBuffer bb, String message, Throwable cause)

Constructor with the binary data that could not be decoded, and the reason why it failed to be, and the cause. The buffer may represent the whole message, or the part of the message most relevant to the decoding error, depending whether the application is using one of the streaming methods or not.

Parameters
bb:ByteBuffer

the byte buffer containing the (part of) the message that could not be decoded.

message:String

the reason for the failure.

cause:Throwable

the cause of the error.

DecodeExceptionback to summary
public DecodeException(String encodedString, String message, Throwable cause)

Constructor with the text data that could not be decoded, and the reason why it failed to be, and the cause. The encoded string may represent the whole message, or the part of the message most relevant to the decoding error, depending whether the application is using one of the streaming methods or not.

Parameters
encodedString:String

the string representing the (part of) the message that could not be decoded.

message:String

the reason for the failure.

cause:Throwable

the cause of the error.

DecodeExceptionback to summary
public DecodeException(ByteBuffer bb, String message)

Constructs a DecodedException with the given ByteBuffer that cannot be decoded, and reason why. The buffer may represent the whole message, or the part of the message most relevant to the decoding error, depending whether the application is using one of the streaming methods or not.

Parameters
bb:ByteBuffer

the byte buffer containing the (part of) the message that could not be decoded.

message:String

the reason for the failure.

DecodeExceptionback to summary
public DecodeException(String encodedString, String message)

Constructs a DecodedException with the given encoded string that cannot be decoded, and reason why. The encoded string may represent the whole message, or the part of the message most relevant to the decoding error, depending whether the application is using one of the streaming methods or not.

Parameters
encodedString:String

the string representing the (part of) the message that could not be decoded.

message:String

the reason for the failure.

Method Detail

getBytesback to summary
public ByteBuffer getBytes()

Return the ByteBuffer containing either the whole message, or the partial message, that could not be decoded, or null if this exception arose from a failure to decode a text message.

Returns:ByteBuffer

the binary data not decoded or null for text message failures.

getTextback to summary
public String getText()

Return the encoded string that is either the whole message, or the partial message that could not be decoded, or null if this exception arose from a failure to decode a binary message..

Returns:String

the text not decoded or null for binary message failures.