C# Class Zlib.ZlibCodec

Datei anzeigen Open project: robertbaker/SevenUpdate Class Usage Examples

Private Properties

Property Type Description
Deflate int
EndDeflate int
EndInflate int
FlushPending void
Inflate int
InitializeDeflate int
InitializeDeflate int
InitializeInflate int
InitializeInflate int
InitializeInflate int
InitializeInflate int
InternalInitializeDeflate int
ReadBuf int

Public Methods

Method Description
ZlibCodec ( ) : System

Create a ZlibCodec.

If you use this default constructor, you will later have to explicitly call InitializeInflate() or InitializeDeflate() before using the ZlibCodec to compress or decompress.

ZlibCodec ( CompressionMode mode ) : System

Create a ZlibCodec that either compresses or decompresses.

Private Methods

Method Description
Deflate ( FlushType flush ) : int

Deflate one batch of data.

You must have set InputBuffer and OutputBuffer before calling this method.

EndDeflate ( ) : int

End a deflation session.

Call this after making a series of one or more calls to Deflate(). All buffers are flushed.

EndInflate ( ) : int

Ends an inflation session.

Call this after successively calling Inflate(). This will cause all buffers to be flushed. After calling this you cannot call Inflate() without a intervening call to one of the InitializeInflate() overloads.

FlushPending ( ) : void
Inflate ( ) : int

Inflate the data in the InputBuffer, placing the result in the OutputBuffer.

You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and AvailableBytesOut before calling this method.

InitializeDeflate ( ) : int

Initialize the ZlibCodec for deflation operation.

The codec will use the MAX window bits and the default level of compression.

InitializeDeflate ( CompressionLevel level, bool wantRfc1950Header ) : int

Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel, and the explicit flag governing whether to emit an RFC1950 header byte pair.

The codec will use the maximum window bits (15) and the specified CompressionLevel. If you want to generate a zlib stream, you should specify true for wantRfc1950Header. In this case, the library will emit a ZLIB header, as defined in RFC 1950, in the compressed stream.

InitializeInflate ( ) : int

Initialize the inflation state.

It is not necessary to call this before using the ZlibCodec to inflate data; It is implicitly called when you call the constructor.

InitializeInflate ( bool expectRfc1950Header ) : int

Initialize the inflation state with an explicit flag to govern the handling of RFC1950 header bytes.

By default, the ZLIB header defined in RFC 1950 is expected. If you want to read a zlib stream you should specify true for expectRfc1950Header. If you have a deflate stream, you will want to specify false. It is only necessary to invoke this initializer explicitly if you want to specify false.

InitializeInflate ( int windowBits ) : int

Initialize the ZlibCodec for inflation, with the specified number of window bits.

InitializeInflate ( int windowBits, bool expectRfc1950Header ) : int

Initialize the inflation state with an explicit flag to govern the handling of RFC1950 header bytes.

If you want to read a zlib stream you should specify true for expectRfc1950Header. In this case, the library will expect to find a ZLIB header, as defined in RFC 1950, in the compressed stream. If you will be reading a DEFLATE or GZIP stream, which does not have such a header, you will want to specify false.

InternalInitializeDeflate ( bool wantRfc1950Header ) : int
ReadBuf ( byte buf, int start, int size ) : int

Method Details

ZlibCodec() public method

Create a ZlibCodec.
If you use this default constructor, you will later have to explicitly call InitializeInflate() or InitializeDeflate() before using the ZlibCodec to compress or decompress.
public ZlibCodec ( ) : System
return System

ZlibCodec() public method

Create a ZlibCodec that either compresses or decompresses.
public ZlibCodec ( CompressionMode mode ) : System
mode CompressionMode Indicates whether the codec should compress (deflate) or decompress (inflate).
return System