Zlib compression or decompression stream.

Syntax

public sealed class ZlibStream : Stream

Examples

Shows how to use GetUploadStream method to decompress a file and upload to the server.

using System;
using System.IO;
using ComponentPro.Compression;
using ComponentPro.Net;

...

// Create a new class instance.
Ftp client = new Ftp();

// Connect to the FTP server.
client.Connect("192.168.0.211");

// Authenticate.
client.Authenticate("test", "test");

// ... 
 
// Get upload stream for remote file 'compressed.z'.
Stream ostream = client.GetUploadStream("/compressed.z");
// Create new file
FileStream fi = new FileStream("d:\\temp\\uncompressed.dat", FileMode.Open, FileAccess.Read);
// Create a new instance of the ZlibInputStream for the compression.
ZlibStream zs = new ZlibStream(ostream, 9);
byte[] buf = new byte[8192];
int read;
while ((read = fi.Read(buf, 0, 8192)) > 0) // Read from the Zlib stream.
{
    zs.Write(buf, 0, read); // And write to the upload stream.
}

zs.Close();
fi.Close();


// ... 
 
// Disconnect.
client.Disconnect();

Inheritance Hierarchy

         ComponentPro.Compression.ComponentPro.Compression.ZlibStream

Framework

.NET Compact Framework.NET Compact Framework

Supported version: 2.0, 3.5, and 3.9
Assembly: ComponentPro.Network.CF (in ComponentPro.Network.CF.dll)

.NET Framework.NET Framework

Supported version: 2.0, 3.0, 3.5, 4.0, 4.5.x, 4.6.x and later
Assembly: ComponentPro.Network (in ComponentPro.Network.dll)

Xamarin AndroidXamarin Android

Supported version: 2.3 and later
Assembly: ComponentPro.Network.Android (in ComponentPro.Network.Android.dll)

Xamarin MacXamarin Mac

Supported version: 2.0.x and later
Assembly: ComponentPro.Network.Mac (in ComponentPro.Network.Mac.dll)

Xamarin iOSXamarin iOS

Supported version: 5.1.x and later
Assembly: ComponentPro.Network.iOS (in ComponentPro.Network.iOS.dll)

See Also