next up previous contents index
Next: Decoding Input Stream ( Up: Lossless Compression Previous: SHA-1 Checksum ( SHACoder   Contents   Index

Encoding Output Stream ( encoding_ostream )


The type encoding_ostream<Coder> is the encoding counterpart of the type ostream from the C++ iostream library. Each instance os of type encoding_ostream<Coder> is attached to a streambuf sb. Every data that is written to os is encoded on-the-fly by an instance of type Coder and then written to sb. All operations and all operators («) defined for C++ ostreams can be applied to encoding_ostream as well.

#include < LEDA/coding/coder_util.h >


encoding_ostream<Coder> os(streambuf* encoded_stream, bool own_stream = false)
    creates an instance os and attaches it to the given streambuf object.


Coder* os.get_coder() returns the instance of Coder which is used for encoding.

void os.close() detaches os from its streambuf object.