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); }
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); }
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; }
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(); } } }
public void SetUp() { outputStream = new MemoryStream(); target = new StreamEncoderOutput(outputStream); }