
public class BundleWriter extends Object
| Modifier and Type | Field and Description | 
|---|---|
private static int | 
INITIAL_BUFFER
Initial buffer size. 
 | 
private static Logging | 
LOG
Class logger for the bundle writer. 
 | 
static int | 
MAGIC
Random magic number. 
 | 
| Constructor and Description | 
|---|
BundleWriter()  | 
| Modifier and Type | Method and Description | 
|---|---|
private ByteBuffer | 
ensureBuffer(int size,
            ByteBuffer buffer,
            WritableByteChannel output)
Ensure the buffer is large enough. 
 | 
private void | 
flushBuffer(ByteBuffer buffer,
           WritableByteChannel output)
Flush the current write buffer to disk. 
 | 
void | 
writeBundleStream(BundleStreamSource source,
                 WritableByteChannel output)
Write a bundle stream to a file output channel. 
 | 
private ByteBufferSerializer<Object>[] | 
writeHeader(BundleStreamSource source,
           ByteBuffer buffer,
           WritableByteChannel output)
Write the header for the given stream to the stream. 
 | 
private static final Logging LOG
private static final int INITIAL_BUFFER
public static final int MAGIC
public void writeBundleStream(BundleStreamSource source, WritableByteChannel output) throws IOException
source - Data sourceoutput - Output channelIOException - on IO errorsprivate void flushBuffer(ByteBuffer buffer, WritableByteChannel output) throws IOException
buffer - Buffer to writeoutput - Output channelIOException - on IO errorsprivate ByteBuffer ensureBuffer(int size, ByteBuffer buffer, WritableByteChannel output) throws IOException
size - Required size to addbuffer - Existing bufferoutput - Output channelIOException - on IO errorsprivate ByteBufferSerializer<Object>[] writeHeader(BundleStreamSource source, ByteBuffer buffer, WritableByteChannel output) throws IOException
source - Bundle streambuffer - Buffer to use for writingoutput - Output channelIOException - on IO errors