Package org.apache.qpid.proton.engine.impl

# Class ByteBufferUtils

java.lang.Object
org.apache.qpid.proton.engine.impl.ByteBufferUtils

public class ByteBufferUtils extends Object

## Constructor Summary

Constructors
Constructor
Description
`ByteBufferUtils()`

## Method Summary

Modifier and Type
Method
Description
`static 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 of `source` into `destinationTransportInput`, calling the TransportInput many times if necessary.
`static int`
`pourArrayToBuffer(byte[] source, int offset, int sizeRequested, ByteBuffer destination)`
Assumes `destination` is ready to be written.
`static int`
`pourBufferToArray(ByteBuffer source, byte[] destination, int offset, int sizeRequested)`
Assumes `source` is ready to be read.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ByteBufferUtils

public ByteBufferUtils()

## Method Details

### pour

public static int pour(ByteBuffer source, ByteBuffer destination)

Returns:
  number of bytes poured

### pourArrayToBuffer

public static int pourArrayToBuffer(byte[] source, int offset, int sizeRequested, ByteBuffer destination)
Assumes `destination` is ready to be written.

Returns:
  number of bytes poured which may be fewer than `sizeRequested` if `destination` has insufficient remaining

### pourAll

public static int pourAll(ByteBuffer source, TransportInput destinationTransportInput) throws TransportException
Pours the contents of `source` into `destinationTransportInput`, calling the TransportInput many times if necessary. If the TransportInput returns a `TransportResult` other than ok, data may remain in source.

Throws:
  `TransportException`

### pourBufferToArray

public static int pourBufferToArray(ByteBuffer source, byte[] destination, int offset, int sizeRequested)
Assumes `source` is ready to be read.

Returns:
  number of bytes poured which may be fewer than `sizeRequested` if `source` has insufficient remaining

### newWriteableBuffer

public static ByteBuffer newWriteableBuffer(int capacity)

### newReadableBuffer

public static ByteBuffer newReadableBuffer(int capacity)