net.rim.device.api.io
Class SharedOutputStream

java.lang.Object
  extended by net.rim.device.api.io.SharedOutputStream

public class SharedOutputStream
extends Object

Output stream that can share its stream data with a number of writers.

Use this class when you want multiple people writing to the same output stream, and have the output in a specific order, but you cannot control the order that they write in. For example, in a MIME Stream, you can have multiple parts, which appear in a specific order, but the user can write to the individual parts in any particular order.


Constructor Summary
SharedOutputStream(OutputStream out)
          Build a shared output stream on provided output stream.
 
Method Summary
 void close()
          Closes this output stream and releases any system resources it uses.
 OutputStream getOutputStream()
          Retrieves a new output stream that can write to this shared stream.
 void writeSeparator()
          Invoked after an output stream is closed and before the next one begins to write to the shared stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

SharedOutputStream

public SharedOutputStream(OutputStream out)
Build a shared output stream on provided output stream.

Parameters:
out - Output stream to use as underlying data buffer for this stream.


Method Detail

getOutputStream

public OutputStream getOutputStream()
Retrieves a new output stream that can write to this shared stream.

Returns:
Output stream that can write to this shared stream.

close

public void close()
           throws IOException
Closes this output stream and releases any system resources it uses.

A closed stream cannot perform output operations, and it cannot be re-opened.

Throws:
IOException - If an I/O error occurs.

writeSeparator

public void writeSeparator()
                    throws IOException
Invoked after an output stream is closed and before the next one begins to write to the shared stream. The default writeSeparator does nothing. It is up to an extending subclass to implement the appropriate behaviour. Invoked after an output stream is closed and before the next one begins to write to the shared stream.

Throws:
IOException - If an I/O error occurs.





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal