Top Description Constructors Methods
org.glassfish.tyrus.core.coder

public Class NoOpByteBufferCoder

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

Encoder and Decoder implementation for ByteBuffer.
Author
Stepan Kopriva

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 ByteBuffer
encode(ByteBuffer
the object being encoded.
object
)

Implements jakarta.websocket.Encoder.Binary.encode.

Encode the given object into a byte array.

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.glassfish.tyrus.core.coder.CoderAdapter:
destroyinit

Constructor Detail

NoOpByteBufferCoderback to summary
public NoOpByteBufferCoder()

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
encodeback to summary
public ByteBuffer encode(ByteBuffer object) throws EncodeException

Implements jakarta.websocket.Encoder.Binary.encode.

Doc from jakarta.websocket.Encoder.Binary.encode.

Encode the given object into a byte array.

Parameters
object:ByteBuffer

the object being encoded.

Returns:ByteBuffer

the binary data.

Annotations
@Override
Exceptions
EncodeException:
The provided object could not be encoded to a byte buffer
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