Package jakarta.websocket
Interface Decoder.Binary<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jakarta.websocket.Decoder
Decoder.Binary<T>, Decoder.BinaryStream<T>, Decoder.Text<T>, Decoder.TextStream<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
decode(ByteBuffer bytes)
Decode the given bytes into an object of type T.boolean
willDecode(ByteBuffer bytes)
Answer whether the given bytes can be decoded into an object of type T.
-
-
-
Method Detail
-
decode
T decode(ByteBuffer bytes) throws DecodeException
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
- the bytes to be decoded.- Returns:
- the decoded object.
- Throws:
DecodeException
- If the provided bytes cannot be decoded to type T
-
willDecode
boolean willDecode(ByteBuffer bytes)
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
- the bytes to be decoded.- Returns:
- whether or not the bytes can be decoded by this decoder.
-
-