public class BufferToArrayCodec extends Object implements ICodec<ByteBuffer,byte[]>
class
for encoders and decoders transforming a ByteBuffer
into an array of bytes.Constructor and Description |
---|
BufferToArrayCodec() |
Modifier and Type | Method and Description |
---|---|
Class<ByteBuffer> |
getInboundType()
Returns the type of the accepted inbound objects.
|
Class<byte[]> |
getOutboundType()
Returns the type of the produced outbound objects.
|
static byte[] |
toArray(ByteBuffer buffer)
Converts a
ByteBuffer into an array of bytes. |
public static byte[] toArray(ByteBuffer buffer)
ByteBuffer
into an array of bytes. If the passed buffer is
backed by an accessible byte array and the number of remaining bytes in the
buffer equals the length of the backing array then it simply returns the
backing array. In other cases it returns a newly created array filled with
the bytes remaining in the buffer.
The passed buffer should be no longer used after calling this method.
buffer
- the buffer to convertpublic Class<ByteBuffer> getInboundType()
ICodec
getInboundType
in interface ICodec<ByteBuffer,byte[]>
public Class<byte[]> getOutboundType()
ICodec
getOutboundType
in interface ICodec<ByteBuffer,byte[]>
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.