C# Class ICSharpCode.SharpZipLib.Zip.Compression.Inflater

Inflater is used to decompress data that has been compressed according to the "deflate" standard described in rfc1951. By default Zlib (rfc1950) headers and footers are expected in the input. You can use constructor public Inflater(bool noHeader) passing true if there is no Zlib header information The usage is as following. First you have to set some input with SetInput(), then Inflate() it. If inflate doesn't inflate any bytes there may be three reasons:
  • IsNeedingInput() returns true because the input buffer is empty. You have to provide more input with SetInput(). NOTE: IsNeedingInput() also returns true when, the stream is finished.
  • IsNeedingDictionary() returns true, you have to provide a preset dictionary with SetDictionary().
  • IsFinished returns true, the inflater has finished.
Once the first output byte is produced, a dictionary will not be needed at a later stage. author of the original java version : John Leuner, Jochen Hoenicke
Exibir arquivo Open project: icsharpcode/SharpZipLib Class Usage Examples

Public Methods

Method Description
Inflate ( byte buffer ) : int

Inflates the compressed stream to the output buffer. If this returns 0, you should check, whether IsNeedingDictionary(), IsNeedingInput() or IsFinished() returns true, to determine why no further output is produced.

Inflate ( byte buffer, int offset, int count ) : int

Inflates the compressed stream to the output buffer. If this returns 0, you should check, whether needsDictionary(), needsInput() or finished() returns true, to determine why no further output is produced.

Inflater ( ) : System

Creates a new inflater or RFC1951 decompressor RFC1950/Zlib headers and footers will be expected in the input data

Inflater ( bool noHeader ) : System

Creates a new inflater.

Reset ( ) : void

Resets the inflater so that a new stream can be decompressed. All pending input and output will be discarded.

SetDictionary ( byte buffer ) : void

Sets the preset dictionary. This should only be called, if needsDictionary() returns true and it should set the same dictionary, that was used for deflating. The getAdler() function returns the checksum of the dictionary needed.

SetDictionary ( byte buffer, int index, int count ) : void

Sets the preset dictionary. This should only be called, if needsDictionary() returns true and it should set the same dictionary, that was used for deflating. The getAdler() function returns the checksum of the dictionary needed.

SetInput ( byte buffer ) : void

Sets the input. This should only be called, if needsInput() returns true.

SetInput ( byte buffer, int index, int count ) : void

Sets the input. This should only be called, if needsInput() returns true.

Private Methods

Method Description
Decode ( ) : bool

Decodes the deflated stream.

DecodeChksum ( ) : bool

Decodes the adler checksum after the deflate stream.

DecodeDict ( ) : bool

Decodes the dictionary checksum after the deflate header.

DecodeHeader ( ) : bool

Decodes a zlib/RFC1950 header.

DecodeHuffman ( ) : bool

Decodes the huffman encoded symbols in the input stream.

Method Details

Inflate() public method

Inflates the compressed stream to the output buffer. If this returns 0, you should check, whether IsNeedingDictionary(), IsNeedingInput() or IsFinished() returns true, to determine why no further output is produced.
/// if buffer has length 0. /// /// if deflated stream is invalid. ///
public Inflate ( byte buffer ) : int
buffer byte /// the output buffer. ///
return int

Inflate() public method

Inflates the compressed stream to the output buffer. If this returns 0, you should check, whether needsDictionary(), needsInput() or finished() returns true, to determine why no further output is produced.
/// if count is less than 0. /// /// if the index and / or count are wrong. /// /// if deflated stream is invalid. ///
public Inflate ( byte buffer, int offset, int count ) : int
buffer byte /// the output buffer. ///
offset int /// the offset in buffer where storing starts. ///
count int /// the maximum number of bytes to output. ///
return int

Inflater() public method

Creates a new inflater or RFC1951 decompressor RFC1950/Zlib headers and footers will be expected in the input data
public Inflater ( ) : System
return System

Inflater() public method

Creates a new inflater.
public Inflater ( bool noHeader ) : System
noHeader bool /// True if no RFC1950/Zlib header and footer fields are expected in the input data /// /// This is used for GZIPed/Zipped input. /// /// For compatibility with /// Sun JDK you should provide one byte of input more than needed in /// this case. ///
return System

Reset() public method

Resets the inflater so that a new stream can be decompressed. All pending input and output will be discarded.
public Reset ( ) : void
return void

SetDictionary() public method

Sets the preset dictionary. This should only be called, if needsDictionary() returns true and it should set the same dictionary, that was used for deflating. The getAdler() function returns the checksum of the dictionary needed.
public SetDictionary ( byte buffer ) : void
buffer byte /// The dictionary. ///
return void

SetDictionary() public method

Sets the preset dictionary. This should only be called, if needsDictionary() returns true and it should set the same dictionary, that was used for deflating. The getAdler() function returns the checksum of the dictionary needed.
/// No dictionary is needed. /// /// The adler checksum for the buffer is invalid ///
public SetDictionary ( byte buffer, int index, int count ) : void
buffer byte /// The dictionary. ///
index int /// The index into buffer where the dictionary starts. ///
count int /// The number of bytes in the dictionary. ///
return void

SetInput() public method

Sets the input. This should only be called, if needsInput() returns true.
public SetInput ( byte buffer ) : void
buffer byte /// the input. ///
return void

SetInput() public method

Sets the input. This should only be called, if needsInput() returns true.
/// No input is needed. /// /// The index and/or count are wrong. ///
public SetInput ( byte buffer, int index, int count ) : void
buffer byte /// The source of input data ///
index int /// The index into buffer where the input starts. ///
count int /// The number of bytes of input to use. ///
return void