10 using System.Runtime.InteropServices;
21 [DllImport(
"ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
22 private static extern int inflateInit_(
ref ZStream sz,
string vs,
int size);
24 [DllImport(
"ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
25 private static extern int inflate(
ref ZStream sz,
int flush);
27 [DllImport(
"ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
28 private static extern int inflateReset(
ref ZStream sz);
30 [DllImport(
"ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
31 private static extern int inflateEnd(
ref ZStream sz);
39 int retval = inflateInit_(
ref _ztream,
Info.
Version, Marshal.SizeOf(_ztream));
41 throw new ZLibException(retval,
"Could not initialize inflater");
56 if (data == null)
throw new ArgumentNullException();
57 if (offset < 0 || count < 0)
throw new ArgumentOutOfRangeException();
58 if ((offset+count) > data.Length)
throw new ArgumentException();
64 while (err >= 0 && inputIndex < total)
67 err = inflate(
ref _ztream, (
int)FlushTypes.None);
69 while (_ztream.avail_out == 0)
72 err = inflate(
ref _ztream, (
int)FlushTypes.None);
75 inputIndex += (
int)_ztream.total_in;
89 err = inflate(
ref _ztream, (
int)FlushTypes.Finish);
94 inflateReset(
ref _ztream);
101 protected override void CleanUp() { inflateEnd(
ref _ztream); }
void setChecksum(uint newSum)
Updates the running checksum property
Implements the common functionality needed for all Codecs
override void Add(byte[] data, int offset, int count)
Adds more data to the codec to be processed.
Inflater()
Constructs an new instance of the Inflater
Implements a data decompressor, using the inflate algorithm in the ZLib dll
void copyInput(byte[] data, int startIndex, int count)
Copies a number of bytes to the internal codec buffer - ready for proccesing
override void CleanUp()
Closes the internal zlib inflate stream
GLsizei GLsizei GLenum GLenum const GLvoid * data
static string Version
Gets the version of ZLib as a string, e.g.
void OnDataAvailable()
Fires the DataAvailable event
void resetOutput()
Resets the internal output buffers to a known state - ready for processing
GLuint GLuint GLsizei count
Encapsulates general information about the ZLib library
const int kBufferSize
The size of the internal buffers
override void Finish()
Finishes up any pending data that needs to be processed and handled.
The exception that is thrown when an error occurs on the zlib dll