Top Fields Constructors Methods
org.eclipse.jetty.ee10.websocket.jakarta.common.decoders

public Class ByteBufferDecoder

extends AbstractDecoder
implements Decoder.Binary<ByteBuffer>
Class Inheritance
All Implemented Interfaces
jakarta.websocket.Decoder.Binary, jakarta.websocket.Decoder
Imports
java.nio.ByteBuffer, jakarta.websocket.DecodeException, .Decoder

Field Summary

Modifier and TypeField and Description
public static final ByteBufferDecoder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ByteBuffer
decode(ByteBuffer
the bytes to be decoded.
bytes
)

Implements jakarta.websocket.Decoder.Binary.decode.

Decode the given bytes into an object of type T.

public boolean
willDecode(ByteBuffer
the bytes to be decoded.
bytes
)

Implements jakarta.websocket.Decoder.Binary.willDecode.

Answer whether the given bytes can be decoded into an object of type T.

Inherited from org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.AbstractDecoder:
destroyinit

Field Detail

INSTANCEback to summary
public static final ByteBufferDecoder INSTANCE

Constructor Detail

ByteBufferDecoderback to summary
public ByteBufferDecoder()

Method Detail

decodeback to summary
public ByteBuffer decode(ByteBuffer bytes) throws DecodeException

Implements jakarta.websocket.Decoder.Binary.decode.

Doc from jakarta.websocket.Decoder.Binary.decode.

Decode the given bytes into an object of type T.

It is not safe for other threads to use the ByteBuffer until the decoding of the given bytes is complete. If the decoding completes successfully, the buffer's limit will be unchanged and the buffer's position will be equal to the limit. If the decoding does not complete successfully, the state of the buffer is undefined.

Parameters
bytes:ByteBuffer

the bytes to be decoded.

Returns:ByteBuffer

the decoded object.

Annotations
@Override
Exceptions
DecodeException:
If the provided bytes cannot be decoded to type T
willDecodeback to summary
public boolean willDecode(ByteBuffer bytes)

Implements jakarta.websocket.Decoder.Binary.willDecode.

Doc from jakarta.websocket.Decoder.Binary.willDecode.

Answer whether the given bytes can be decoded into an object of type T.

It is not safe for other threads to use the ByteBuffer until this method completes. When the method completes, the buffer will be in the same state as it was at the start of the method call.

Parameters
bytes:ByteBuffer

the bytes to be decoded.

Returns:boolean

whether or not the bytes can be decoded by this decoder.

Annotations
@Override