net.officefloor.plugin.stream
Interface OutputBufferStream

All Known Implementing Classes:
OutputBufferStreamImpl, SynchronizedOutputBufferStream

public interface OutputBufferStream

Appends data to the BufferStream.

Author:
Daniel Sagenschneider

Method Summary
 void append(BufferSquirt squirt)
           Appends the BufferSquirt to the BufferStream.
 void append(ByteBuffer buffer)
           Appends the ByteBuffer to the BufferStream.
 void close()
          Closes the stream releasing resources.
 OutputStream getOutputStream()
           Obtains an OutputStream that writes content to the BufferStream.
 void write(BufferPopulator populator)
          Writes content to a ByteBuffer of the BufferStream.
 void write(byte[] bytes)
           Writes the bytes to the BufferStream.
 void write(byte[] data, int offset, int length)
           Writes the bytes to the BufferStream.
 

Method Detail

getOutputStream

OutputStream getOutputStream()

Obtains an OutputStream that writes content to the BufferStream.

This allows use of existing stream implementations.

Returns:
OutputStream.

write

void write(byte[] bytes)
           throws IOException

Writes the bytes to the BufferStream.

The bytes are copied into the BufferStream so that the input array is no longer required.

Parameters:
bytes - Bytes to be written to the BufferStream.
Throws:
IOException - If fails to write the bytes.

write

void write(byte[] data,
           int offset,
           int length)
           throws IOException

Writes the bytes to the BufferStream.

The bytes are copied into the BufferStream so that the input array is no longer required.

Parameters:
data - Bytes to be written to the BufferStream.
offset - Offset into the data to start obtaining bytes to write.
length - Number of bytes to write from the data.
Throws:
IOException - If fails to write the bytes.

write

void write(BufferPopulator populator)
           throws IOException
Writes content to a ByteBuffer of the BufferStream.

Parameters:
populator - BufferPopulator to write data to the ByteBuffer.
Throws:
IOException - If fails to write data to ByteBuffer.

append

void append(ByteBuffer buffer)
            throws IOException

Appends the ByteBuffer to the BufferStream.

The ByteBuffer is used directly by the BufferStream and must not be changed until the BufferStream is no longer being used. This should only be used when the ByteBuffer never changes (contains static information).

Use append(BufferSquirt) over this method to know when the ByteBuffer can be modified again.

Parameters:
buffer - ByteBuffer ready to be read from.
Throws:
IOException - If fails to append to the BufferStream.

append

void append(BufferSquirt squirt)
            throws IOException

Appends the BufferSquirt to the BufferStream.

BufferSquirt.close() is invoked when the BufferStream no longer requires the BufferSquirt.

Parameters:
squirt - BufferSquirt to append to the BufferStream.
Throws:
IOException - If fails to append to the BufferStream.

close

void close()
           throws IOException
Closes the stream releasing resources.

Throws:
IOException - If fails to close the BufferStream.


Copyright © 2005-2011. All Rights Reserved.