Cross-Platform C++

ot::io
class FilterWriter

#include "ot/io/FilterWriter.h"

ot::io::Writer ot::SynchronizedObject ot::ManagedObject A base class that derives from Writer but also contains another Writer which is used as the output sink. FilterWriter and its sister class FilterReader provide an extensible framework for building chains of character processing.

The FilterWriter class overrides all methods of Writer with versions that pass requests to the contained Writer. Derived classes of FilterWriter are expected to further override some of these methods to perform some useful function before the characters are written out to the sink (which may be yet another FilterWriter).

Multi-threaded considerations:
The contained Writer is used as the lock object for synchronized methods.



Constructor/Destructor Summary
FilterWriter(Writer* pWriter)
         Construct a FilterWriter with pWriter as the contained Writer.

Method Summary
 virtual void close()
         Closes the character stream, flushing it first.
 virtual void flush()
         Flushes any output buffers before forcing the output to its final destination.
 virtual void flushBuffers()
         If this Writer maintains an output buffer, the buffer is emptied and written to the output destination without requesting the final destination to flush the output.
protected  RefPtr< Writer > getWriter() const
         Returns the Writer contained by this FilterWriter.
 virtual void write(CharType c)
         Writes the single CharType character c.
 virtual void write(const Character& ch)
         Writes the Unicode character ch to the output stream.
 virtual void write(const String& str)
         Writes the sequence of CharType characters contained in the String str.
 virtual void write(const CharType* pStr, size_t len)
         Writes an array of CharType characters.

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

Methods inherited from class ot::SynchronizedObject
lock, unlock

Methods inherited from class ot::io::Writer
getLock

Constructor/Destructor Detail

FilterWriter

 FilterWriter(Writer* pWriter)
Construct a FilterWriter with pWriter as the contained Writer.

Exceptions:
NullPointerException - if pWriter is null.

Method Detail

close

virtual void close()
Closes the character stream, flushing it first.

Multi-threaded considerations:
Synchronized for safe access from multiple concurrent threads.

flush

virtual void flush()
Flushes any output buffers before forcing the output to its final destination.

Exceptions:
IOException - if an I/O error occurs.
See also:
flushBuffers()
Multi-threaded considerations:
Synchronized for safe access from multiple concurrent threads.

flushBuffers

virtual void flushBuffers()
If this Writer maintains an output buffer, the buffer is emptied and written to the output destination without requesting the final destination to flush the output. The base class implementation does nothing.

See also:
flush()
Multi-threaded considerations:
Synchronized for safe access from multiple concurrent threads.

getWriter

protected RefPtr< WritergetWriter() const
Returns the Writer contained by this FilterWriter.


write

virtual void write(CharType c)
Writes the single CharType character c. Depending on the character encoding being employed, a single CharType character may not represent a complete Unicode character. In this case the characters from subsequent write operations will be used to complete the multi-character sequence.

Parameters:
c - the character to write.
Exceptions:
IOException - if an I/O error occurs.
See also:
write(const Character& ch)
Multi-threaded considerations:
Synchronized for safe access from multiple concurrent threads.

write

virtual void write(const Character& ch)
Writes the Unicode character ch to the output stream. Depending on the character encoding being employed, a single Unicode character may be represented internally using a sequence of more than one CharType characters. In this case, as many CharType characters as are required to encode the Unicode character are written.

Parameters:
ch - the Unicode character to write.
Exceptions:
IOException - if an I/O error occurs.
See also:
write(CharType c)
Multi-threaded considerations:
Synchronized for safe access from multiple concurrent threads.

write

virtual void write(const String& str)
Writes the sequence of CharType characters contained in the String str.

Parameters:
str - the String to write.
Exceptions:
IOException - if an I/O error occurs.
Multi-threaded considerations:
Synchronized for safe access from multiple concurrent threads.

write

virtual void write(const CharType* pStr,
                   size_t len)
Writes an array of CharType characters.

Parameters:
pStr - a pointer to the first CharType character in the array
len - the number of CharType characters to write
Exceptions:
IOException - if an I/O error occurs.
Multi-threaded considerations:
Synchronized for safe access from multiple concurrent threads.


Cross-Platform C++

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

Copyright © 2000-2003 ElCel Technology   Trademark Acknowledgements