|A layered in stream that filters its data through a buffer. More...|
|A layered out stream that filters its data through a buffer. More...|
|A stream for bzlib decompression. More...|
|A stream for bzlib compression. More...|
|An in stream that is connected to something outside of ObjectiveLib. More...|
|An out stream that is connected to something outside of ObjectiveLib. More...|
|An in stream that is connected to a memory buffer. More...|
|An out stream connected to a memory buffer. More...|
|A connected stream that reads its data from a file. More...|
|A connected stream that sends its data to a file. More...|
|A stream for zlib decompression that reads data in gzip format. More...|
|A stream for zlib compression that writes data in the gzip format. More...|
|Base class for reading data. More...|
|An in stream that is layered over another in stream. More...|
|An out stream that is layered over another out stream. More...|
|A stream that can read objects and classes. More...|
|A stream that is capable of writing objects and classes. More...|
|Base class for writing data. More...|
|protocol||< OLStreamable >|
|A protocol for writing to streams. More...|
|A stream for zlib decompression. More...|
|A stream for zlib compression. More...|
All stream classes are derived either from OLInStream or OLOutStream. There are two branches of inheritance from the base stream classes: connected streams and layered streams. Connected streams (subclasses of OLConnectedOutStream and OLConnectedInStream) communicate with entities outside of the ObjectiveLib streaming subsystem, like files and sockets, while layered streams (subclasses of OLLayeredOutStream and OLLayeredInStream) are only capable of communicating with other ObjectiveLib streams.
Connected streams can be used without any layered streams, but generally the services provided by layered streams will be advantageous. Layered streams act as filters for the data and can include services such as buffering and compression. For example, to write some data to a file that is compatible with the command-line tool gzip, one constructs a set of streams as follows.
OLGzipOutStream* gzstream = [OLGzipOutStream streamWithOutStream: [OLFileOutStream streamWithPath: "mydata.gz"]]; [gzstream writeInt: 6]; [gzstream close];
The layers in the previous sample are stacked as follows, where the OLFileOutStream is the connected stream and the OLGzipOutStream is the layered stream.
Of course, in the real world you would probably put an OLBufferingOutStream in between the OLFileOutStream and the OLGzipOutStream, since you'd probably be writing a lot of data. Additionally, if you wanted to write objects to the file, you would have to put an OLObjectOutStream on the top of the stream stack. Something like this.
OLObjectOutStream* ostream = [OLObjectOutStream streamWithOutStream: [OLGzipOutStream streamWithOutStream: [OLBufferingOutStream streamWithOutStream: [OLFileOutStream streamWithPath: "mydata.gz"]]]]; [ostream writeObject: objectWithLotsOfDataToWrite]; [ostream close];
And the layers would map like this.