public class BufferHolderToArrayCodec extends Object implements ICodec<IByteBufferHolder,byte[]>
class
for encoders and decoders transforming an IByteBufferHolder
into an array of bytes.Constructor and Description |
---|
BufferHolderToArrayCodec() |
Modifier and Type | Method and Description |
---|---|
Class<IByteBufferHolder> |
getInboundType()
Returns the type of the accepted inbound objects.
|
Class<byte[]> |
getOutboundType()
Returns the type of the produced outbound objects.
|
static byte[] |
toArray(IByteBufferHolder holder)
Converts an
IByteBufferHolder into an array of bytes. |
public static byte[] toArray(IByteBufferHolder holder)
IByteBufferHolder
into an array of bytes. If the passed
buffer holder stores only one buffer and this 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 holder.
The passed buffer holder should be no longer used after calling this method.
holder
- the buffer holder to convertpublic Class<IByteBufferHolder> getInboundType()
ICodec
getInboundType
in interface ICodec<IByteBufferHolder,byte[]>
public Class<byte[]> getOutboundType()
ICodec
getOutboundType
in interface ICodec<IByteBufferHolder,byte[]>
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.