Top Description Inners Fields Constructors Methods
org.eclipse.jetty.io

public Class ByteBufferCallbackAccumulator

extends Object
Class Inheritance
Imports
java.nio.ByteBuffer, java.util.ArrayList, .List, org.eclipse.jetty.util.BufferUtil, .Callback

This class can be used to accumulate pairs of ByteBuffer and Callback, and eventually copy these into a single ByteBuffer or byte array and succeed the callbacks.

This class is not thread safe and callers must do mutual exclusion.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final List<ByteBufferCallbackAccumulator.Entry>
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addEntry(ByteBuffer buffer, Callback callback)

public void
public int

Returns:

the total length of the content in the accumulator.
getLength
()

Get the total length of the content in the accumulator..

public byte[]
takeByteArray()

Returns: a newly allocated byte array containing all content written into the accumulator.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_entriesback to summary
private final List<ByteBufferCallbackAccumulator.Entry> _entries
_lengthback to summary
private int _length

Constructor Detail

ByteBufferCallbackAccumulatorback to summary
public ByteBufferCallbackAccumulator()

Method Detail

addEntryback to summary
public void addEntry(ByteBuffer buffer, Callback callback)
failback to summary
public void fail(Throwable t)
getLengthback to summary
public int getLength()

Get the total length of the content in the accumulator..

Returns:int

the total length of the content in the accumulator.

takeByteArrayback to summary
public byte[] takeByteArray()
Returns:byte[]

a newly allocated byte array containing all content written into the accumulator.

writeToback to summary
public void writeTo(ByteBuffer buffer)
org.eclipse.jetty.io back to summary

private Class ByteBufferCallbackAccumulator.Entry

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final ByteBuffer
private final Callback

Constructor Summary

AccessConstructor and Description
pack-priv
Entry(ByteBuffer buffer, Callback callback)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private final ByteBuffer buffer
callbackback to summary
private final Callback callback

Constructor Detail

Entryback to summary
pack-priv Entry(ByteBuffer buffer, Callback callback)