Hi,
How do you decompress a stream now that this class is obsolete? I used to have:
public static byte[] Decompress(byte[] settings)
{
using (var zippedStream = new ZipInputStream(new MemoryStream(settings)))
{
return ReadFully(zippedStream);
}
}
public static byte[] ReadFully(System.IO.Stream input)
{
var buffer = new byte[16 * 1024];
using (var ms = new MemoryStream())
{
int read;
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
{
ms.Write(buffer, 0, read);
}
return ms.ToArray();
}
}
Is it still ok to use CompressedStream directly and if so how do you create the CompressionSettings as the Method setter is protected?
Thanks,
Scott
How do you decompress a stream now that this class is obsolete? I used to have:
public static byte[] Decompress(byte[] settings)
{
using (var zippedStream = new ZipInputStream(new MemoryStream(settings)))
{
return ReadFully(zippedStream);
}
}
public static byte[] ReadFully(System.IO.Stream input)
{
var buffer = new byte[16 * 1024];
using (var ms = new MemoryStream())
{
int read;
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
{
ms.Write(buffer, 0, read);
}
return ms.ToArray();
}
}
Is it still ok to use CompressedStream directly and if so how do you create the CompressionSettings as the Method setter is protected?
Thanks,
Scott