Class ByteBufferUtils
java.lang.Object
org.apache.qpid.proton.engine.impl.ByteBufferUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBuffernewReadableBuffer(int capacity) static ByteBuffernewWriteableBuffer(int capacity) static intpour(ByteBuffer source, ByteBuffer destination) static intpourAll(ByteBuffer source, TransportInput destinationTransportInput) Pours the contents ofsourceintodestinationTransportInput, calling the TransportInput many times if necessary.static intpourArrayToBuffer(byte[] source, int offset, int sizeRequested, ByteBuffer destination) Assumesdestinationis ready to be written.static intpourBufferToArray(ByteBuffer source, byte[] destination, int offset, int sizeRequested) Assumessourceis 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) Assumesdestinationis ready to be written.- Returns:
- number of bytes poured which may be fewer than
sizeRequestedifdestinationhas insufficient remaining
-
pourAll
public static int pourAll(ByteBuffer source, TransportInput destinationTransportInput) throws TransportException Pours the contents ofsourceintodestinationTransportInput, calling the TransportInput many times if necessary. If the TransportInput returns aTransportResultother than ok, data may remain in source.- Throws:
TransportException
-
pourBufferToArray
public static int pourBufferToArray(ByteBuffer source, byte[] destination, int offset, int sizeRequested) Assumessourceis ready to be read.- Returns:
- number of bytes poured which may be fewer than
sizeRequestedifsourcehas insufficient remaining
-
newWriteableBuffer
-
newReadableBuffer
-