Class ByteBufferUtils
java.lang.Object
org.apache.qpid.proton.engine.impl.ByteBufferUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBuffer
newReadableBuffer
(int capacity) static ByteBuffer
newWriteableBuffer
(int capacity) static int
pour
(ByteBuffer source, ByteBuffer destination) static int
pourAll
(ByteBuffer source, TransportInput destinationTransportInput) Pours the contents ofsource
intodestinationTransportInput
, calling the TransportInput many times if necessary.static int
pourArrayToBuffer
(byte[] source, int offset, int sizeRequested, ByteBuffer destination) Assumesdestination
is ready to be written.static int
pourBufferToArray
(ByteBuffer source, byte[] destination, int offset, int sizeRequested) Assumessource
is ready to be read.
-
Constructor Details
-
ByteBufferUtils
public ByteBufferUtils()
-
-
Method Details
-
pour
- Returns:
- number of bytes poured
-
pourArrayToBuffer
public static int pourArrayToBuffer(byte[] source, int offset, int sizeRequested, ByteBuffer destination) Assumesdestination
is ready to be written.- Returns:
- number of bytes poured which may be fewer than
sizeRequested
ifdestination
has insufficient remaining
-
pourAll
public static int pourAll(ByteBuffer source, TransportInput destinationTransportInput) throws TransportException Pours the contents ofsource
intodestinationTransportInput
, calling the TransportInput many times if necessary. If the TransportInput returns aTransportResult
other than ok, data may remain in source.- Throws:
TransportException
-
pourBufferToArray
public static int pourBufferToArray(ByteBuffer source, byte[] destination, int offset, int sizeRequested) Assumessource
is ready to be read.- Returns:
- number of bytes poured which may be fewer than
sizeRequested
ifsource
has insufficient remaining
-
newWriteableBuffer
-
newReadableBuffer
-