Überblick
Beispiele
Schnappschüsse
Vergleiche
Anwendungen
Herunterladen
Documentation
Basar
Status & Fahrplan
Häufig gestellte Fragen
Autoren & Lizenz
Forum
Ultimate++ finanziell unterstützen
Diese Seite durchsuchen
Sprache
Deutsch













SourceForge.net Logo



Diese Seite wurde noch nicht übersetzt. Willst du es übersetzen?

 

Zlib

 

class Zlib

This class encapsulates zlib library to provide compression/decompression utility.

Encapsulation is specifically designed to allow streaming mode of operations. Input data are fed using Put method and can be either obtained at output as partial String, or through output callback. If using String, it is also always possible to clear this output partial String to conserve memory.

 

Public Method List

 

Callback2<const void *, intWhenOut

Output callback. Represents "consumer function": When there are output data available, they are passed out using this callback. Default value stores data into output String inside Zlib.

 


 

void Compress()

Sets Zlib into compression mode ("deflate" in zlib terminology).

 


 

void Decompress()

Sets Zlib into decompression mode ("inflate" in zlib terminology).

 


 

void Put(const void *ptr, int size)

void Put(const String& s)

Puts a block of data to be processed (compressed or decompressed based on mode) by Zlib.

 


 

void End()

Signals the end of input stream.

 


 

void Clear()

Resets Zlib to initial state (throws out data).

 


 

const String& Get() const

operator const String&() const

const String& operator~() const

Returns current output String (it only gets created if WhenOut is not redirected somewhere else).

 


 

void ClearOut()

Clears output String. Can be called anytime.

 


 

dword GetCRC() const

Returns CRC of uncompressed stream, if CRC mode is active.

 


 

bool IsError() const

Returns true if there was error processing input.

 


 

String GetGZipName() const

If GZip mode is active and Gzip header is processed, returns the name of file.

 


 

String GetGZipComment() const

If GZip mode is active and Gzip header is processed, returns the gzip comment.

 


 

Zlib& GZip(bool gzip_ = true)

Activates GZip mode. In this mode Zlib is able to directly process .gzip file format.

 


 

Zlib& Header(bool hdr_ = true)

Activates zlib header (see zlib documentation for details).

 


 

Zlib& NoHeader()

Same as Header(false).

 


 

Zlib& CRC(bool b = true)

Activates CRC mode. In this mode, Zlib gathers CRC of uncompressed data that can be at the end obtained by GetCRC method.

 


 

Zlib& NoCRC()

Same as CRC(false).

 


 

Zlib& ChunkSize(int n)

Sets the maximum amount of input or output data to be processed in single zlib call.

 


 

Zlib()

Constructor.

 


 

~Zlib()

Destructor.

 

 

Compression / decompression functions

 

int ZCompress(Stream& out, Stream& in, Gate2<int, intprogress = false)

String ZCompress(const void *data, int len, Gate2<int, intprogress = false)

String ZCompress(const String& s, Gate2<int, intprogress = false)

Compresses raw data using zlib from input stream in, memory data, len or input string s to output stream out (in this case returns a number of bytes written or negative integer to signal error) or into String return value. progress can be used to track progress of operation, returning true cancels it.

 


 

int ZDecompress(Stream& out, Stream& in, Gate2<int, intprogress = false)

String ZDecompress(const String& s, Gate2<int, intprogress = false)

String ZDecompress(const void *data, int len, Gate2<int, intprogress = false)

Decompresses raw data using zlib from input stream in, memory data, len or input string s to output stream out (in this case returns a number of bytes written or negative integer to signal error) or into String return value. progress can be used to track progress of operation, returning true cancels it.

 


 

int GZCompress(Stream& out, Stream& in, int size, Gate2<int, intprogress = false)

String GZCompress(const void *data, int len, Gate2<int, intprogress = false)

String GZCompress(const String& s, Gate2<int, intprogress = false)

Compresses raw data into gzip file format from input stream in, memory data, len or input string s to output stream out (in this case returns a number of bytes written or negative integer to signal error) or into String return value. progress can be used to track progress of operation, returning true cancels it.

 


 

int GZDecompress(Stream& out, Stream& in, int size, Gate2<int, intprogress = false)

String GZDecompress(const void *data, int len, Gate2<int, intprogress = false)

String GZDecompress(const String& s, Gate2<int, intprogress = false)

Decompresses raw data into gzip file format from input stream in, memory data, len or input string s to output stream out (in this case returns a number of bytes written or negative integer to signal error) or into String return value. progress can be used to track progress of operation, returning true cancels it.

 

 

Diese Seite gibt es auch in english. Willst du mitmachen?