public class NoOpByteArrayCoder extends CoderAdapter implements Decoder.Binary<byte[]>, Encoder.Binary<byte[]>
Decoder.Binary<T>, Decoder.BinaryStream<T>, Decoder.Text<T>, Decoder.TextStream<T>
Encoder.Binary<T>, Encoder.BinaryStream<T>, Encoder.Text<T>, Encoder.TextStream<T>
Constructor and Description |
---|
NoOpByteArrayCoder() |
Modifier and Type | Method and Description |
---|---|
byte[] |
decode(java.nio.ByteBuffer bytes)
Decode the given bytes into an object of type T.
|
java.nio.ByteBuffer |
encode(byte[] object)
Encode the given object into a byte array.
|
boolean |
willDecode(java.nio.ByteBuffer bytes)
Answer whether the given bytes can be decoded into an object of type T.
|
destroy, init
public java.nio.ByteBuffer encode(byte[] object) throws EncodeException
Encoder.Binary
encode
in interface Encoder.Binary<byte[]>
object
- the object being encoded.EncodeException
- The provided object could not be encoded to a byte bufferpublic boolean willDecode(java.nio.ByteBuffer bytes)
Decoder.Binary
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.
willDecode
in interface Decoder.Binary<byte[]>
bytes
- the bytes to be decoded.public byte[] decode(java.nio.ByteBuffer bytes) throws DecodeException
Decoder.Binary
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.
decode
in interface Decoder.Binary<byte[]>
bytes
- the bytes to be decoded.DecodeException
- If the provided bytes cannot be decoded to type TCopyright © 2012–2020 Oracle Corporation. All rights reserved.