ByteArray ba = byteArrayFactory.create( 1 );
return ba.getSingleIoBuffer();
}
int actualLength = last() - first();
{
Node node = bas.getFirst();
ByteArray ba = node.getByteArray();
if ( ba.last() == actualLength )
{
return ba.getSingleIoBuffer();
}
}
// Replace all nodes with a single node.
ByteArray target = byteArrayFactory.create( actualLength );
IoBuffer bb = target.getSingleIoBuffer();
Cursor cursor = cursor();
cursor.put( bb ); // Copy all existing data into target IoBuffer.
while ( !bas.isEmpty() )
{
Node node = bas.getLast();
ByteArray component = node.getByteArray();
bas.removeLast();
component.free();
}
bas.addLast( target );
return bb;