コード例 #1
0
        private static void Encode(Stream inputStream, Stream outputStream)
        {
            var encoderInput = new StreamEncoderInput(inputStream);
            var encoderOutput = new StreamEncoderOutput(outputStream);
            var codeTable = new FrameworkDictionaryCodeTable(1000);
            var encoder = new LzwEncoder(encoderInput, encoderOutput, codeTable);

            encoder.Encode();
            outputStream.Flush();
            outputStream.Seek(0, SeekOrigin.Begin);
        }
コード例 #2
0
        public void SetUp()
        {
            byte[] dataToEncode = System.Text.Encoding.ASCII.GetBytes("ABABBA");
            inputStream = new MemoryStream(dataToEncode);
            outputStream = new MemoryStream();

            var input = new StreamEncoderInput(inputStream);
            var output = new StreamEncoderOutput(outputStream);
            var codeTable = new FrameworkDictionaryCodeTable(4000);
            target = new LzwEncoder(input, output, codeTable);
        }
コード例 #3
0
        private LzwEncoder CreateEncoder()
        {
            inputStream = new MemoryStream(dataToEncode);
            outputStream = new MemoryStream();

            var input = new StreamEncoderInput(inputStream);
            var output = new StreamEncoderOutput(outputStream);
            ICodeTable codeTable = CreateCodeTable();
            var encoder = new LzwEncoder(input, output, codeTable);

            return encoder;
        }
コード例 #4
0
        private byte[] Encode(byte[] dataToEncode)
        {
            using(var encoderInputStream = new MemoryStream(dataToEncode))
            {
                using(var encoderOutputStream = new MemoryStream())
                {
                    var input = new StreamEncoderInput(encoderInputStream);
                    var output = new StreamEncoderOutput(encoderOutputStream);
                    ICodeTable codeTable = new FrameworkDictionaryCodeTable(10000);
                    var encoder = new LzwEncoder(input, output, codeTable);

                    encoder.Encode();

                    return encoderOutputStream.ToArray();
                }
            }
        }
コード例 #5
0
 public void SetUp()
 {
     outputStream = new MemoryStream();
     target = new StreamEncoderOutput(outputStream);
 }