class OutFilterStream : public Stream
Adapter Stream that glues an output stream with some filtering object, typically of compression/decompression class. Output stream can also be omitted, in that case OutFilterStream is useful to convert anything capable of consuming data into Stream.
virtual void Close()
Finalizes operations. Does not closes the output stream. Repeated call does nothing.
Stream *out
Pointer to the output stream. Can be NULL.
Callback2<const void *, int> Filter
Callback to filter input function. This is called when OutFilterStream needs to output a chunk of buffered data.
Callback End
Callback to filter finalization. Called on closing the stream.
Event<int64> WhenPos
This is invoked when OutFilterStream passes data to the filter. Parameter is number of unfiltered bytes so far. Useful for progress indicators.
void Out(const void *ptr, int size)
Method serving as filter output. Basically performs out->Put(ptr, size), also keeps track of output bytes written (see GetCount).
int64 GetCount() const
Returns a number of bytes written to the output stream (if OutFilterStream is used for compression, this is the compressed size). Note that this number is 'complete' only after the OutFilterStream is closed, because of buffering of data chunks.
template <class F> void Set(Stream& out_, F& filter)
Sets the output stream and filter. Filter must have WhenOut callback which is connected to Out method and Put and End methods that are connected to Filter and End callbacks.
OutFilterStream()
Default constructor.
template <class F> OutFilterStream(Stream& in, F& filter)
Equivalent of default constructor followed by Set.
~OutFilterStream()
Calls Close.
|