10 using System.Runtime.InteropServices;
17 #region Internal types 22 internal enum FlushTypes
24 None, Partial, Sync, Full, Finish, Block
27 #region ZStream structure 29 [StructLayoutAttribute(LayoutKind.Sequential, Pack=4, Size=0, CharSet=CharSet.Ansi)]
30 internal struct ZStream
32 public IntPtr next_in;
36 public IntPtr next_out;
37 public uint avail_out;
38 public uint total_out;
40 [MarshalAs(UnmanagedType.LPStr)]
82 #region Exception classes 83 public class ZLibException : ApplicationException
94 public ZLibException(
int errorCode,
string msg) : base(String.Format(
"ZLib error {0} {1}", errorCode, msg))
103 public ZLibException(
int errorCode) : base(String.Format(
"ZLib error {0}", errorCode))
148 void Update(
string data);
155 void Update(
string data, Encoding encoding);
186 void Add(
byte[] data);
219 [DllImport(
"ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
222 [DllImport(
"ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
226 #region Private stuff 230 private static int bitSize(
uint bits)
253 public bool HasDebugInfo {
get {
return 0 != (_flags & 0x100); } }
258 public bool UsesAssemblyCode {
get {
return 0 != (_flags & 0x200); } }
263 public int SizeOfUInt {
get {
return bitSize(_flags & 3); } }
268 public int SizeOfULong {
get {
return bitSize((_flags >> 2) & 3); } }
273 public int SizeOfPointer {
get {
return bitSize((_flags >> 4) & 3); } }
278 public int SizeOfOffset {
get {
return bitSize((_flags >> 6) & 3); } }
Declares methods and events for implementing compressors/decompressors
DataAvailableHandler DataAvailable
Occurs when more processed data are available.
ZLibException(int errorCode)
Initializes a new instance of the ZLibException class with a specified error code ...
ZLibException(int errorCode, string msg)
Initializes a new instance of the ZLibException class with a specified error message and error code ...
The default compression level with a reasonable compromise between compression and speed ...
GLsizei GLsizei GLenum GLenum const GLvoid * data
The fastest available compression level.
Info()
Constructs an instance of the Info class.
const char *ZEXPORT zlibVersion()
Declares methods and properties that enables a running checksum to be calculated
uLong ZEXPORT zlibCompileFlags()
GLuint GLuint GLsizei count
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
delegate void DataAvailableHandler(byte[] data, int startIndex, int count)
Represents the method that will be called from a codec when new data are available.
Encapsulates general information about the ZLib library
CompressLevel
Defines constants for the available compression levels in zlib
The maximum compression rate available.