class Compressor

An abstract data (de)compressor. More...

Contains pure virtuals
Full nameTelEngine::Compressor
Definition#include <yateclass.h>
InheritsTelEngine::String [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Members


Detailed Description

The Compressor class provides an abstraction for data (de)compressor classes. The String component keeps an optional object name to be used for debug purposes

inline  Compressor (const char* format, const char* name = 0)

Compressor

Constructor

Parameters:
formatCompression format
nameOptional object name

 ~Compressor ()

~Compressor

[virtual]

Destructor

inline const String&  format ()

format

[const]

Retrieve (de)compressor format

Returns: The format of this (de)compressor

bool  init (bool comp = true, bool decomp = true, const NamedList& params = NamedList::empty())

init

[virtual]

Initialize

Parameters:
compTrue to initialize compressor
decompTrue to initialize decompressor
paramsOptional parameters

Returns: True on success

void  finalize (bool comp)

finalize

[virtual]

Finalize the (de)compression

Parameters:
compTrue to finalize compression, false to finalize decompression

int  compress (const void* buf, unsigned int len, DataBlock& dest)

compress

[virtual]

Compress the input buffer, flush all pending data, append compressed data to the received data block

Parameters:
bufPointer to input data
lenLength of input in bytes
destDestination buffer

Returns: The number of bytes wrote to compressor, negative on error

int  decompress (const void* buf, unsigned int len, DataBlock& dest)

decompress

[virtual]

Decompress the input buffer, flush all pending data, append decompressed data to the received data block

Parameters:
bufPointer to input data
lenLength of input in bytes
destDestination buffer

Returns: The number of bytes wrote to decompressor, negative on error

int  writeComp (const void* buf, unsigned int len, bool flush)

writeComp

[pure virtual]

Push data to compressor. Flush compressor input if input buffer is NULL or the length is 0 and flush is true

Parameters:
bufPointer to input data
lenLength of input in bytes
flushTrue to compress all now, false to let the compressor accumulate more data for better compression

Returns: The number of bytes written, negative on error. An incomplete write may occur if the output buffer is full

inline int  writeComp (const DataBlock& data, bool flush)

writeComp

Push data to compressor

Parameters:
dataInput data block
flushTrue to compress all now, false to let the compressor accumulate more data for better compression

Returns: The number of bytes written, negative on error. An incomplete write may occur if the output buffer is full

inline int  writeComp (const String& data, bool flush)

writeComp

Push data to compressor

Parameters:
dataInput string
flushTrue to compress all now, false to let the compressor accumulate more data for better compression

Returns: The number of bytes written, negative on error. An incomplete write may occur if the output buffer is full

int  readComp (DataBlock& buf, bool flush)

readComp

[pure virtual]

Read data from compressor. Append it to 'buf'

Parameters:
bufDestination data block
flushTrue to flush all compressor input data

Returns: The number of bytes read, negative on error

int  writeDecomp (const void* buf, unsigned int len, bool flush)

writeDecomp

[pure virtual]

Push data to decompressor

Parameters:
bufPointer to input data
lenLength of input in bytes
flushTrue to try to decompress all data

Returns: The number of bytes written, negative on error. An incomplete write may occur if the output buffer is full

inline int  writeDecomp (const DataBlock& data, bool flush)

writeDecomp

Push data to decompressor

Parameters:
dataInput data block
flushTrue to try to decompress all data

Returns: The number of bytes written, negative on error. An incomplete write may occur if the output buffer is full

inline int  writeDecomp (const String& data, bool flush)

writeDecomp

Push data to decompressor

Parameters:
dataInput string
flushTrue to try to decompress all data

Returns: The number of bytes written, negative on error. An incomplete write may occur if the output buffer is full

int  readDecomp (DataBlock& buf, bool flush)

readDecomp

[pure virtual]

Read data from decompressor. Append it to 'buf'

Parameters:
bufDestination data block
flushTrue to flush all decompressor input data

Returns: The number of bytes read, negative on error

String m_format

m_format

[protected]


Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.