ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine Class Reference

Low level compression engine for deflate algorithm which uses a 32K sliding window with secondary compression from Huffman/Shannon-Fano codes. More...

Inheritance diagram for ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine:

ICSharpCode::SharpZipLib::Zip::Compression::DeflaterConstants List of all members.

Public Member Functions

 DeflaterEngine (DeflaterPending pending)
 Construct instance with pending buffer.
void Reset ()
 Reset internal state.
void ResetAdler ()
 Reset Adler checksum.
void SetLevel (int lvl)
 Set the deflate level (0-9).
void FillWindow ()
 Fill the window.
void SetDictionary (byte[] buffer, int offset, int length)
 Set compression dictionary.
bool Deflate (bool flush, bool finish)
 Deflate drives actual compression of data.
void SetInput (byte[] buf, int off, int len)
 Sets input data to be deflated. Should only be called when
NeedsInput()</code>
                    returns true.

bool NeedsInput ()
 Return true if input is needed via SetInput SetInput.

Properties

int Adler
 Get current value of Adler checksum.
int TotalIn
 Total data processed.
DeflateStrategy Strategy
 Get/set the DeflateStrategydeflate strategy.

Private Member Functions

void UpdateHash ()
int InsertString ()
 Inserts the current string in the head hash and returns the previous value for this hash.
void SlideWindow ()
bool FindLongestMatch (int curMatch)
 Find the best (longest) string in the window matching the string starting at strstart.
bool DeflateStored (bool flush, bool finish)
bool DeflateFast (bool flush, bool finish)
bool DeflateSlow (bool flush, bool finish)

Private Attributes

int ins_h
short[] head
 Hashtable, hashing three characters to an index for window, so that window[index]..window[index+2] have this hash code. Note that the array should really be unsigned short, so you need to and the values with 0xffff.
short[] prev
 
prev[index &amp; WMASK]</code> points to the previous index that has the
                    same hash code as the string starting at index.  This way 
                    entries with the same hash code are in a linked list.
                    Note that the array should really be unsigned short, so you need
                    to and the values with 0xffff.

int matchStart
int matchLen
bool prevAvailable
int blockStart
int strstart
 Points to the current character in the window.
int lookahead
 lookahead is the number of characters starting at strstart in window that are valid. So window[strstart] until window[strstart+lookahead-1] are valid characters.
byte[] window
 This array contains the part of the uncompressed stream that is of relevance. The current character is indexed by strstart.
DeflateStrategy strategy
int max_chain
int max_lazy
int niceLength
int goodLength
int comprFunc
 The current compression function.
byte[] inputBuf
 The input data for compression.
int totalIn
 The total bytes of input read.
int inputOff
 The offset into inputBuf, where input data starts.
int inputEnd
 The end offset of the input data.
DeflaterPending pending
DeflaterHuffman huffman
Adler32 adler
 The adler checksum.

Static Private Attributes

static int TOO_FAR = 4096

Detailed Description

Low level compression engine for deflate algorithm which uses a 32K sliding window with secondary compression from Huffman/Shannon-Fano codes.

Definition at line 90 of file DeflaterEngine.cs.


Constructor & Destructor Documentation

ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::DeflaterEngine DeflaterPending  pending  )  [inline]
 

Construct instance with pending buffer.

Parameters:
pending Pending buffer to use
>

Definition at line 179 of file DeflaterEngine.cs.


Member Function Documentation

bool ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::Deflate bool  flush,
bool  finish
[inline]
 

Deflate drives actual compression of data.

Definition at line 728 of file DeflaterEngine.cs.

bool ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::DeflateFast bool  flush,
bool  finish
[inline, private]
 

Definition at line 555 of file DeflaterEngine.cs.

bool ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::DeflateSlow bool  flush,
bool  finish
[inline, private]
 

Definition at line 632 of file DeflaterEngine.cs.

bool ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::DeflateStored bool  flush,
bool  finish
[inline, private]
 

Definition at line 522 of file DeflaterEngine.cs.

void ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::FillWindow  )  [inline]
 

Fill the window.

Definition at line 365 of file DeflaterEngine.cs.

bool ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::FindLongestMatch int  curMatch  )  [inline, private]
 

Find the best (longest) string in the window matching the string starting at strstart.

Preconditions:

                    strstart + MAX_MATCH &lt;= window.length.</code>

                    <param name="curMatch"></param>
                    <returns>True if a match greater than the minimum length is found</returns>

Definition at line 407 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::InsertString  )  [inline, private]
 

Inserts the current string in the head hash and returns the previous value for this hash.

Returns:
The previous hash value

Definition at line 318 of file DeflaterEngine.cs.

bool ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::NeedsInput  )  [inline]
 

Return true if input is needed via SetInput SetInput.

Definition at line 786 of file DeflaterEngine.cs.

void ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::Reset  )  [inline]
 

Reset internal state.

Definition at line 197 of file DeflaterEngine.cs.

void ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::ResetAdler  )  [inline]
 

Reset Adler checksum.

Definition at line 219 of file DeflaterEngine.cs.

void ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::SetDictionary byte[]  buffer,
int  offset,
int  length
[inline]
 

Set compression dictionary.

Definition at line 494 of file DeflaterEngine.cs.

void ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::SetInput byte[]  buf,
int  off,
int  len
[inline]
 

Sets input data to be deflated. Should only be called when

NeedsInput()</code>
                    returns true.

Parameters:
buf The buffer containing input data.
off The index of the first byte of data.
len The number of bytes of data to use as input.

Definition at line 763 of file DeflaterEngine.cs.

void ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::SetLevel int  lvl  )  [inline]
 

Set the deflate level (0-9).

Definition at line 257 of file DeflaterEngine.cs.

void ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::SlideWindow  )  [inline, private]
 

Definition at line 340 of file DeflaterEngine.cs.

void ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::UpdateHash  )  [inline, private]
 

Definition at line 303 of file DeflaterEngine.cs.


Member Data Documentation

Adler32 ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::adler [private]
 

The adler checksum.

Definition at line 171 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::blockStart [private]
 

Definition at line 116 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::comprFunc [private]
 

The current compression function.

Definition at line 143 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::goodLength [private]
 

Definition at line 138 of file DeflaterEngine.cs.

short [] ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::head [private]
 

Hashtable, hashing three characters to an index for window, so that window[index]..window[index+2] have this hash code. Note that the array should really be unsigned short, so you need to and the values with 0xffff.

Definition at line 102 of file DeflaterEngine.cs.

DeflaterHuffman ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::huffman [private]
 

Definition at line 166 of file DeflaterEngine.cs.

byte [] ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::inputBuf [private]
 

The input data for compression.

Definition at line 148 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::inputEnd [private]
 

The end offset of the input data.

Definition at line 163 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::inputOff [private]
 

The offset into inputBuf, where input data starts.

Definition at line 158 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::ins_h [private]
 

Definition at line 94 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::lookahead [private]
 

lookahead is the number of characters starting at strstart in window that are valid. So window[strstart] until window[strstart+lookahead-1] are valid characters.

Definition at line 129 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::matchLen [private]
 

Definition at line 114 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::matchStart [private]
 

Definition at line 113 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::max_chain [private]
 

Definition at line 138 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::max_lazy [private]
 

Definition at line 138 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::niceLength [private]
 

Definition at line 138 of file DeflaterEngine.cs.

DeflaterPending ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::pending [private]
 

Definition at line 165 of file DeflaterEngine.cs.

short [] ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::prev [private]
 

prev[index &amp; WMASK]</code> points to the previous index that has the
                    same hash code as the string starting at index.  This way 
                    entries with the same hash code are in a linked list.
                    Note that the array should really be unsigned short, so you need
                    to and the values with 0xffff.

Definition at line 111 of file DeflaterEngine.cs.

bool ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::prevAvailable [private]
 

Definition at line 115 of file DeflaterEngine.cs.

DeflateStrategy ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::strategy [private]
 

Definition at line 137 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::strstart [private]
 

Points to the current character in the window.

Definition at line 121 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::TOO_FAR = 4096 [static, private]
 

Definition at line 92 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::totalIn [private]
 

The total bytes of input read.

Definition at line 153 of file DeflaterEngine.cs.

byte [] ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::window [private]
 

This array contains the part of the uncompressed stream that is of relevance. The current character is indexed by strstart.

Definition at line 135 of file DeflaterEngine.cs.


Property Documentation

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::Adler [get]
 

Get current value of Adler checksum.

Definition at line 227 of file DeflaterEngine.cs.

DeflateStrategy ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::Strategy [get, set]
 

Get/set the DeflateStrategydeflate strategy.

Definition at line 245 of file DeflaterEngine.cs.

int ICSharpCode::SharpZipLib::Zip::Compression::DeflaterEngine::TotalIn [get]
 

Total data processed.

Definition at line 236 of file DeflaterEngine.cs.


The documentation for this class was generated from the following file:
Generated on Fri Jun 23 21:50:07 2006 for OblivionModTranslator by  doxygen 1.4.6-NO