OSMQ
v2.0.1

osmq.io
Class StringOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byosmq.io.StringOutputStream
All Implemented Interfaces:
WriterStream

public class StringOutputStream
extends java.io.FilterOutputStream
implements WriterStream

An OutputStream filter that supports writing Strings and ASCII byte arrays to an output stream. To write non-ASCII bytes to a stream, use the PacketOutputStream class.

The corollary StringInputStream is able to read logical Strings and arrays of bytes as they were written.

This class is thread safe.


Constructor Summary
StringOutputStream(java.io.OutputStream out)
           
 
Method Summary
 void println(java.lang.String s)
          Writes an integer (size) to the output stream as 4 bytes.
 void writeBytes(byte[] value)
           
 void writeNull()
          Writes a null object to the stream which is ignored by the corresponding ReaderStream.
 
Methods inherited from class java.io.FilterOutputStream
close, flush, write, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface osmq.io.WriterStream
close, flush
 

Constructor Detail

StringOutputStream

public StringOutputStream(java.io.OutputStream out)
Method Detail

writeNull

public void writeNull()
               throws java.io.IOException
Description copied from interface: WriterStream
Writes a null object to the stream which is ignored by the corresponding ReaderStream. This method is used for testing whether a socket stream is still active.

Specified by:
writeNull in interface WriterStream
Throws:
java.io.IOException

writeBytes

public void writeBytes(byte[] value)
                throws java.io.IOException
Specified by:
writeBytes in interface WriterStream
Throws:
java.io.IOException

println

public void println(java.lang.String s)
             throws java.io.IOException
Writes an integer (size) to the output stream as 4 bytes.

Specified by:
println in interface WriterStream
Throws:
java.io.IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed

(c) 2000 - 2003 MQue Systems
All Rights Reserved