Decoder.Binary<T>, Decoder.BinaryStream<T>, Decoder.Text<T>, Decoder.TextStream<T>
Modifier and Type | Method and Description |
---|---|
T |
decode(java.nio.ByteBuffer bytes)
Decode the given bytes into an object of type T.
|
boolean |
willDecode(java.nio.ByteBuffer bytes)
Answer whether the given bytes can be decoded into an object of type T.
|
T decode(java.nio.ByteBuffer bytes) throws DecodeException
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.
bytes
- the bytes to be decoded.DecodeException
- If the provided bytes cannot be decoded to type Tboolean willDecode(java.nio.ByteBuffer bytes)
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.
bytes
- the bytes to be decoded.