|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.officefloor.plugin.stream.synchronise.SynchronizedOutputBufferStream
public class SynchronizedOutputBufferStream
Synchronized OutputBufferStream.
| Constructor Summary | |
|---|---|
SynchronizedOutputBufferStream(OutputBufferStream backingStream,
Object mutex)
Initiate. |
|
| 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SynchronizedOutputBufferStream(OutputBufferStream backingStream,
Object mutex)
backingStream - Backing OutputBufferStream.mutex - Mutex for synchronising on.| Method Detail |
|---|
public OutputStream getOutputStream()
OutputBufferStream
Obtains an OutputStream that writes content to the
BufferStream.
This allows use of existing stream implementations.
getOutputStream in interface OutputBufferStreamOutputStream.
public void write(byte[] bytes)
throws IOException
OutputBufferStream
Writes the bytes to the BufferStream.
The bytes are copied into the BufferStream so that the input
array is no longer required.
write in interface OutputBufferStreambytes - Bytes to be written to the BufferStream.
IOException - If fails to write the bytes.
public void write(byte[] data,
int offset,
int length)
throws IOException
OutputBufferStream
Writes the bytes to the BufferStream.
The bytes are copied into the BufferStream so that the input
array is no longer required.
write in interface OutputBufferStreamdata - 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.
IOException - If fails to write the bytes.
public void write(BufferPopulator populator)
throws IOException
OutputBufferStreamByteBuffer of the BufferStream.
write in interface OutputBufferStreampopulator - BufferPopulator to write data to the
ByteBuffer.
IOException - If fails to write data to ByteBuffer.
public void append(ByteBuffer buffer)
throws IOException
OutputBufferStream
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 OutputBufferStream.append(BufferSquirt) over this method to know when the
ByteBuffer can be modified again.
append in interface OutputBufferStreambuffer - ByteBuffer ready to be read from.
IOException - If fails to append to the BufferStream.
public void append(BufferSquirt squirt)
throws IOException
OutputBufferStream
Appends the BufferSquirt to the BufferStream.
BufferSquirt.close() is invoked when the BufferStream no
longer requires the BufferSquirt.
append in interface OutputBufferStreamsquirt - BufferSquirt to append to the BufferStream.
IOException - If fails to append to the BufferStream.
public void close()
throws IOException
OutputBufferStream
close in interface OutputBufferStreamIOException - If fails to close the BufferStream.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||