Пример #1
0
        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());
        }
Пример #2
0
        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");
        }