![]() |
The Simons
|
#include <Stream.h>
Inheritance diagram for Stream:
The Stream class is the root of the streams hierarchy, which includes the FileStream classes, which connect to the underlying filesystem and perform basic read and write operations, and the FormatStream classes, which wrap around the FileStream classes and provide data encoding and decoding in different formats. Further PipeStream subclasses may act as data connections between objects that produce or consume data. A Stream must always be explicitly opened before it is used; and it may be closed after use (otherwise, it will be closed automatically when it is no longer reachable). Stream provides a protocol to test the state of the Stream, which is implemented in descendant classes.
Public Member Functions | |
Stream () | |
Construct an empty Stream. | |
virtual | ~Stream () |
Release a Stream. | |
virtual Void | openOn (StringID) |
Open this Stream on a pathname. | |
virtual Void | open () |
Open this Stream. | |
virtual Void | close () |
Close this Stream. | |
virtual StringID | name () const |
Return the name of this Stream. | |
virtual Boolean | exists () const |
Test if this Stream exists. | |
virtual Boolean | empty () const |
Test if this Stream is empty. | |
virtual Boolean | ready () const |
Test if this Stream is ready. | |
virtual Boolean | failed () const |
Test if this Stream has failed. | |
virtual Boolean | source () const |
Test if this Stream is a source. | |
virtual Boolean | sink () const |
Test if this Stream is a sink. | |
Protected Member Functions | |
Void | readFailure (StringID, ObjectID) const |
Report that a read-operation failed. | |
Void | writeFailure (StringID, ObjectID) const |
Report that a write-operation failed. | |
Stream (const Stream &) | |
Copy another Stream. |
|
Copy another Stream. This method is trivial, since Stream is abstract and has no attributes. Required by C++ to ensure that copying a Stream faithfully copies an Object.
|
|
Construct an empty Stream.
|
|
Release a Stream. Perform all closing actions upon the Stream before releasing it. |
|
Close this Stream. Disconnect this Stream from its underlying source or sink. This method is abstract. Reimplemented in FormatStream, Input, Output, and WebOutput. |
|
Test if this Stream is empty. Use this method to discover when there is no more data to read from this Stream. Streams to which data is being written are never empty.
Reimplemented in FormatStream, and Input. |
|
Test if this Stream exists. Use this method to test if the connection with the underlying file system was successfully opened.
Reimplemented in FormatStream, Input, and Output. |
|
Test if this Stream has failed. Use this method to test if the Stream failed to complete the previous input or output operation.
Reimplemented in FormatStream, Input, and Output. |
|
Return the name of this Stream. The result depends on what kind of Stream this is. A FormatStream will return the name of the underlying FileStream that it encapsulates. A FileStream will return the file path name that was supplied, or if no path name was supplied, one of the standard stream names "Standard Input", "Standard Output" or "Standard Error". This method is abstract.
Reimplemented in FileStream, and FormatStream. |
|
Open this Stream. Reconnect this Stream with its underlying source or sink, using the existing pathname. This method is abstract. Reimplemented in FormatStream, Input, Output, and WebOutput. |
|
Open this Stream on a pathname. Connect this Stream with a new source or sink, named by the supplied pathname. This method is abstract.
Reimplemented in CGIReader, FileStream, FormatStream, and WebOutput. |
|
Report that a read-operation failed. Provided for convenience, this method is inherited by all streams and may be used to raise a ReadFailure exception to signal that the Stream failed while attempting to read a datum into a variable of a given Type. If the ReadFailure has some prior cause, a second exception is chained to this one.
|
|
Test if this Stream is ready. Use this method to test if the Stream is ready for the next input or output operation.
Reimplemented in FormatStream, Input, and Output. |
|
Test if this Stream is a sink. Use this method to test if the Stream was opened for output, as a sink for the data.
Reimplemented in FormatStream, and Output. |
|
Test if this Stream is a source. Use this method to test if the Stream was opened for input, as a source of data.
Reimplemented in FormatStream, and Input. |
|
Report that a write-operation failed. Provided for convenience, this method is inherited by all streams and may be used to raise a WriteFailure exception to signal that the Stream failed while attempting to write a datum from a variable of a given Type. If the WriteFailure has some prior cause, a second exception is chained to this one.
|