C# Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
Email
Email Object
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Amazon S3
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

C# Gzip Compression and Ungzip

Download: Chilkat .NET Assemblies

Gzip compress and uncompress in C#.

    Chilkat.Gzip gzip = new Chilkat.Gzip();
    gzip.UnlockComponent("Anythying for 30-day trial");
    
    // File-to-file GZip compression
    gzip.CompressFile("test.txt","test.txt.gz");
    
    // File-to-file ungzip
    gzip.UncompressFile("test.txt.gz","testOut.txt");
    
    // File-to-memory ungzip.
    byte [] uncompressedData = gzip.UncompressFileToMem("test.txt.gz");
    
    FileStream fStream = new FileStream("testOut2.txt", FileMode.CreateNew);
    BinaryWriter bw = new BinaryWriter(fStream);
    bw.Write(uncompressedData);
    bw.Close();
    fStream.Close();
    
    // Memory-to-memory Gzip compression:
    int i;
    string s = "";
    for (i=0; i<50; i++)
    {
	s = s + "Hello World!\n";
    }
    byte [] inBytes = System.Text.Encoding.ASCII.GetBytes(s);
    byte [] compressedData = gzip.CompressMemory(inBytes);
    
    uncompressedData = gzip.UncompressMemory(compressedData);
    string uncompressedString = System.Text.Encoding.ASCII.GetString(uncompressedData);
    
    // Memory-to-file Gzip compression
    gzip.CompressMemToFile(inBytes,"testOut3.txt.gz");

Important: The download for this example does not contain the ChilkatDotNet.dll which
must be downloaded and installed separately at http://www.chilkatsoft.com/downloads.asp.
Once installed, add a reference to the DLL in the project by following the instructions at
http://www.example-code.com/csharp/step2.asp

 

© 2000-2012 Chilkat Software, Inc. All Rights Reserved.

Email Component · XML Parser