Top Constructors Methods
org.conscrypt

pack-priv final Class BufferUtils

extends Object
Class Inheritance
Static Imports
java.lang.Math.min, org.conscrypt.Preconditions.checkArgument

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
checkNotNull(ByteBuffer[] buffers)

Throws IllegalArgumentException if any of the buffers in the array are null.

pack-priv static void
consume(ByteBuffer[] sourceBuffers, int toConsume)

Marks toConsume bytes of data as consumed from the buffer array.

pack-priv static ByteBuffer
copyNoConsume(ByteBuffer[] buffers, ByteBuffer destination, int maxAmount)

Copies up to maxAmount bytes from a buffer array to destination.

pack-priv static ByteBuffer
getBufferLargerThan(ByteBuffer[] buffers, int minSize)

Looks for a buffer in the buffer array which EITHER is larger than minSize AND has no preceding non-empty buffers OR is the only non-empty buffer in the array.

pack-priv static long
remaining(ByteBuffer[] buffers)

Returns the total number of bytes remaining in the buffer array.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

BufferUtilsback to summary
private BufferUtils()

Method Detail

checkNotNullback to summary
pack-priv static void checkNotNull(ByteBuffer[] buffers)

Throws IllegalArgumentException if any of the buffers in the array are null.

consumeback to summary
pack-priv static void consume(ByteBuffer[] sourceBuffers, int toConsume)

Marks toConsume bytes of data as consumed from the buffer array.

Exceptions
IllegalArgumentException:
if there are fewer than toConsume bytes remaining
copyNoConsumeback to summary
pack-priv static ByteBuffer copyNoConsume(ByteBuffer[] buffers, ByteBuffer destination, int maxAmount)

Copies up to maxAmount bytes from a buffer array to destination. The copied data is not marked as consumed from the source buffers, on the assumption the copy will be passed to some method which will consume between 0 and maxAmount bytes which can then be reflected in the source array using the consume() method.

getBufferLargerThanback to summary
pack-priv static ByteBuffer getBufferLargerThan(ByteBuffer[] buffers, int minSize)

Looks for a buffer in the buffer array which EITHER is larger than minSize AND has no preceding non-empty buffers OR is the only non-empty buffer in the array.

remainingback to summary
pack-priv static long remaining(ByteBuffer[] buffers)

Returns the total number of bytes remaining in the buffer array.