public static byte[] Decompress(byte[] data) { MemoryStream ot = new MemoryStream(); LzwInputStream CompInStream = new LzwInputStream(new MemoryStream(data)); int ch = CompInStream.ReadByte(); while (ch != -1) { ot.WriteByte((byte)ch); ch = CompInStream.ReadByte(); } return(ot.GetBuffer()); }
public void ZeroLengthInputStream() { LzwInputStream lis = new LzwInputStream(new MemoryStream()); bool exception = false; try { lis.ReadByte(); } catch { exception = true; } Assert.IsTrue(exception, "reading from an empty stream should cause an exception"); }