Cross-Platform C++

ot::io
class OutputStream  (abstract)

#include "ot/io/OutputStream.h"

ot::ManagedObject ot::io::BufferedOutputStream ot::io::ByteArrayOutputStream ot::io::FileOutputStream ot::io::FilterOutputStream Abstract base class with the ability to write bytes to a data sink. Concrete classes derived from OutputStream may be used to write bytes to a wide range of data sinks including the console, a file or a network socket connection.

Unlike the standard C++ ostream, this class does not concern itself with formatting, rather it limits itself to the writing out of data. In this respect it is closer to the standard streambuf class - but does not have the added complication of supporting a read capability.

OutputStreams only concern themselves with the writing of bytes - not characters. If the application uses characters (as most do) then an OutputStream can be wrapped by an OutputStreamWriter that knows how the OutputStream should be encoded.




Method Summary
 virtual void close()
         Closes the output stream and releases system resources associated with the stream.
 virtual void flush()
         Forces all buffered data to be written out and sent to the final data sink.
 virtual void flushBuffers()
         Forces all data buffers associated with this output stream to be written out.
 virtual void write(Byte x)
         Writes the single byte x to this output stream.
 virtual void write(const Byte* pBuffer, size_t bufLen)=0
         Writes an array of bytes to this output stream.

Methods inherited from class ot::ManagedObject
addRef, getRefCount, onFinalRelease, operator=, release

Typedefs

unit_type

typedef Byte unit_type

Method Detail

close

virtual void close()
Closes the output stream and releases system resources associated with the stream. Once an OutputStream is closed further calls to write(), flush() or flushBuffers() will result in an IOException being thrown. Further calls to close() are legal but have no effect.

Exceptions:
IOException - if an I/O error occurs.

flush

virtual void flush()
Forces all buffered data to be written out and sent to the final data sink.

Exceptions:
IOException - if an I/O error occurs.
See also:
flushBuffers()

flushBuffers

virtual void flushBuffers()
Forces all data buffers associated with this output stream to be written out. This may not cause the data to be sent to the final sink if the underlying sink maintains its own buffering scheme.

Exceptions:
IOException - if an I/O error occurs.
See also:
flush()

write

virtual void write(Byte x)
Writes the single byte x to this output stream.

Parameters:
x - the byte to write
Exceptions:
IOException - if an I/O error occurs.

write

virtual void write(const Byte* pBuffer,
                   size_t bufLen)=0
Writes an array of bytes to this output stream.

Parameters:
pBuffer - pointer to the start of an array of bytes to be written
bufLen - length of the byte array
Exceptions:
NullPointerException - if pBuffer is null.
IOException - if an I/O error occurs.


Cross-Platform C++

Found a bug or missing feature? Please email us at support@elcel.com

Copyright © 2000-2003 ElCel Technology   Trademark Acknowledgements