public Read ( byte array, int offset, int count ) : int | ||
array | byte | |
offset | int | |
count | int | |
return | int |
using System.IO; using System.IO.Compression; string filePath = @"C:\data\compressedData.bin"; using (FileStream fs = File.OpenRead(filePath)) using (DeflateStream ds = new DeflateStream(fs, CompressionMode.Decompress)) using (StreamReader sr = new StreamReader(ds)) { string uncompressedData = sr.ReadToEnd(); // Process uncompressed data }
using System.IO; using System.IO.Compression; byte[] compressedData = // Compressed data byte array using (MemoryStream ms = new MemoryStream(compressedData)) using (DeflateStream ds = new DeflateStream(ms, CompressionMode.Decompress)) using (StreamReader sr = new StreamReader(ds)) { string uncompressedData = sr.ReadToEnd(); // Process uncompressed data }In this example, a DeflateStream is created to read compressed data from a byte array. The data is then decompressed and read using a StreamReader to obtain the uncompressed data. Package Library: The DeflateStream class is part of the System.IO.Compression assembly, which is included in the .NET Framework and .NET Core runtime libraries.