DotZLib::CodecBase Class Reference

Implements the common functionality needed for all Codecs. More...

Inherits DotZLib::Codec.

Inherited by DotZLib::Deflater, and DotZLib::Inflater.

Inheritance diagram for DotZLib::CodecBase:

Inheritance graph
[legend]
Collaboration diagram for DotZLib::CodecBase:

Collaboration graph
[legend]

Public Member Functions

 CodecBase ()
 Initializes a new instance of the CodeBase class.
void Add (byte[] data)
 Adds more data to the codec to be processed.
abstract void Add (byte[] data, int offset, int count)
 Adds more data to the codec to be processed.
abstract void Finish ()
 Finishes up any pending data that needs to be processed and handled.
void Dispose ()
 Releases any unmanaged resources and calls the CleanUp() method of the derived class.

Data Fields

event DataAvailableHandler DataAvailable
 Occurs when more processed data are available.

Protected Member Functions

void OnDataAvailable ()
 Fires the DataAvailable event.
abstract void CleanUp ()
 Performs any codec specific cleanup.
void copyInput (byte[] data, int startIndex, int count)
 Copies a number of bytes to the internal codec buffer - ready for proccesing.
void resetOutput ()
 Resets the internal output buffers to a known state - ready for processing.
void setChecksum (uint newSum)
 Updates the running checksum property.

Protected Attributes

bool _isDisposed = false
 True if the object instance has been disposed, false otherwise.
const int kBufferSize = 16384
 The size of the internal buffers.

Properties

uint Checksum
 Gets the checksum of the data that has been added so far.

Private Member Functions

 ~CodecBase ()
 Destroys this instance.
void CleanUp (bool isDisposing)

Private Attributes

internal ZStream _ztream = new ZStream()
 Instance of the internal zlib buffer structure that is passed to all functions in the zlib dll.
byte[] _outBuffer = new byte[kBufferSize]
byte[] _inBuffer = new byte[kBufferSize]
GCHandle _hInput
GCHandle _hOutput
uint _checksum = 0

Detailed Description

Implements the common functionality needed for all Codecs.

Definition at line 16 of file CodecBase.cs.


Constructor & Destructor Documentation

DotZLib::CodecBase::CodecBase  )  [inline]
 

Initializes a new instance of the CodeBase class.

Definition at line 50 of file CodecBase.cs.

References _hInput, _hOutput, _inBuffer, _outBuffer, and CleanUp().

DotZLib::CodecBase::~CodecBase  )  [inline, private]
 

Destroys this instance.

Definition at line 123 of file CodecBase.cs.

References CleanUp().


Member Function Documentation

abstract void DotZLib::CodecBase::Add byte[]  data,
int  offset,
int  count
[pure virtual]
 

Adds more data to the codec to be processed.

Parameters:
data Byte array containing the data to be added to the codec
offset The index of the first byte to add from data
count The number of bytes to add
Adding data may, or may not, raise the DataAvailable event This must be implemented by a derived class

Implements DotZLib::Codec.

Implemented in DotZLib::Deflater, and DotZLib::Inflater.

void DotZLib::CodecBase::Add byte[]  data  )  [inline]
 

Adds more data to the codec to be processed.

Parameters:
data Byte array containing the data to be added to the codec
Adding data may, or may not, raise the DataAvailable event

Implements DotZLib::Codec.

Definition at line 90 of file CodecBase.cs.

void DotZLib::CodecBase::CleanUp bool  isDisposing  )  [inline, private]
 

Definition at line 143 of file CodecBase.cs.

References _hInput, _hOutput, _isDisposed, and CleanUp().

abstract void DotZLib::CodecBase::CleanUp  )  [protected, pure virtual]
 

Performs any codec specific cleanup.

This must be implemented by a derived class

Implemented in DotZLib::Deflater, and DotZLib::Inflater.

Referenced by CleanUp(), CodecBase(), Dispose(), and ~CodecBase().

void DotZLib::CodecBase::copyInput byte[]  data,
int  startIndex,
int  count
[inline, protected]
 

Copies a number of bytes to the internal codec buffer - ready for proccesing.

Parameters:
data The byte array that contains the data to copy
startIndex The index of the first byte to copy
count The number of bytes to copy from data

Definition at line 168 of file CodecBase.cs.

References _hInput, _inBuffer, _ztream, Array(), DotZLib::ZStream::avail_in, DotZLib::ZStream::next_in, and DotZLib::ZStream::total_in.

Referenced by DotZLib::Inflater::Add(), and DotZLib::Deflater::Add().

void DotZLib::CodecBase::Dispose  )  [inline]
 

Releases any unmanaged resources and calls the CleanUp() method of the derived class.

Definition at line 131 of file CodecBase.cs.

References CleanUp().

abstract void DotZLib::CodecBase::Finish  )  [pure virtual]
 

Finishes up any pending data that needs to be processed and handled.

This must be implemented by a derived class

Implements DotZLib::Codec.

Implemented in DotZLib::Deflater, and DotZLib::Inflater.

void DotZLib::CodecBase::OnDataAvailable  )  [inline, protected]
 

Fires the DataAvailable event.

Definition at line 75 of file CodecBase.cs.

References _outBuffer, _ztream, DataAvailable, null, resetOutput(), and DotZLib::ZStream::total_out.

Referenced by DotZLib::Inflater::Add(), DotZLib::Deflater::Add(), DotZLib::Inflater::Finish(), and DotZLib::Deflater::Finish().

void DotZLib::CodecBase::resetOutput  )  [inline, protected]
 

Resets the internal output buffers to a known state - ready for processing.

Definition at line 180 of file CodecBase.cs.

References _hOutput, _ztream, DotZLib::ZStream::avail_out, kBufferSize, DotZLib::ZStream::next_out, and DotZLib::ZStream::total_out.

Referenced by DotZLib::Deflater::Deflater(), DotZLib::Inflater::Finish(), DotZLib::Deflater::Finish(), DotZLib::Inflater::Inflater(), and OnDataAvailable().

void DotZLib::CodecBase::setChecksum uint  newSum  )  [inline, protected]
 

Updates the running checksum property.

Parameters:
newSum The new checksum value

Definition at line 191 of file CodecBase.cs.

References _checksum.

Referenced by DotZLib::Inflater::Add(), DotZLib::Deflater::Add(), DotZLib::Inflater::Finish(), and DotZLib::Deflater::Finish().


Field Documentation

uint DotZLib::CodecBase::_checksum = 0 [private]
 

Definition at line 43 of file CodecBase.cs.

Referenced by setChecksum().

GCHandle DotZLib::CodecBase::_hInput [private]
 

Definition at line 40 of file CodecBase.cs.

Referenced by CleanUp(), CodecBase(), and copyInput().

GCHandle DotZLib::CodecBase::_hOutput [private]
 

Definition at line 41 of file CodecBase.cs.

Referenced by CleanUp(), CodecBase(), and resetOutput().

byte [] DotZLib::CodecBase::_inBuffer = new byte[kBufferSize] [private]
 

Definition at line 38 of file CodecBase.cs.

Referenced by CodecBase(), and copyInput().

bool DotZLib::CodecBase::_isDisposed = false [protected]
 

True if the object instance has been disposed, false otherwise.

Definition at line 30 of file CodecBase.cs.

Referenced by CleanUp().

byte [] DotZLib::CodecBase::_outBuffer = new byte[kBufferSize] [private]
 

Definition at line 37 of file CodecBase.cs.

Referenced by CodecBase(), and OnDataAvailable().

internal ZStream DotZLib::CodecBase::_ztream = new ZStream() [private]
 

Instance of the internal zlib buffer structure that is passed to all functions in the zlib dll.

Definition at line 25 of file CodecBase.cs.

Referenced by DotZLib::Inflater::Add(), DotZLib::Deflater::Add(), DotZLib::Inflater::CleanUp(), DotZLib::Deflater::CleanUp(), copyInput(), DotZLib::Deflater::Deflater(), DotZLib::Inflater::Finish(), DotZLib::Deflater::Finish(), DotZLib::Inflater::Inflater(), OnDataAvailable(), and resetOutput().

event DataAvailableHandler DotZLib::CodecBase::DataAvailable
 

Occurs when more processed data are available.

Implements DotZLib::Codec.

Definition at line 70 of file CodecBase.cs.

Referenced by OnDataAvailable().

const int DotZLib::CodecBase::kBufferSize = 16384 [protected]
 

The size of the internal buffers.

Definition at line 35 of file CodecBase.cs.

Referenced by DotZLib::Inflater::Add(), DotZLib::Deflater::Add(), and resetOutput().


Property Documentation

uint DotZLib::CodecBase::Checksum [get]
 

Gets the checksum of the data that has been added so far.

Implements DotZLib::Codec.

Definition at line 114 of file CodecBase.cs.


The documentation for this class was generated from the following file:
Generated on Fri Apr 14 23:25:15 2006 for minix by  doxygen 1.4.6