Esempio n. 1
0
File: Lzw.cs Progetto: zer09/Cosmos
        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());
        }
Esempio n. 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");
        }