public static byte[] Decompress(Stream input, int outputLength) { var decoder = new LZMADecoder(); using (var output = new MemoryStream(outputLength)) { input.Position += 4; var lzmaProperties = new byte[5]; input.Read(lzmaProperties, 0, 5); decoder.SetDecoderProperties(lzmaProperties); decoder.Code(input, output, input.Length, outputLength, null); return(output.ToArray()); } }
public static byte[] DecompressBuffer(byte[] data, int bufferSize) { var lzmaDecoder = new LZMADecoder(); using (var inStream = new MemoryStream(data)) using (var outStream = new MemoryStream(bufferSize)) { inStream.Position += 4; var lzmaProperties = new byte[5]; inStream.Read(lzmaProperties, 0, 5); lzmaDecoder.SetDecoderProperties(lzmaProperties); lzmaDecoder.Code(inStream, outStream, inStream.Length, bufferSize, null); return outStream.ToArray(); } }
public static byte[] DecompressBuffer(byte[] data, int bufferSize) { var lzmaDecoder = new LZMADecoder(); using (var inStream = new MemoryStream(data)) using (var outStream = new MemoryStream(bufferSize)) { inStream.Position += 4; var lzmaProperties = new byte[5]; inStream.Read(lzmaProperties, 0, 5); lzmaDecoder.SetDecoderProperties(lzmaProperties); lzmaDecoder.Code(inStream, outStream, inStream.Length, bufferSize, null); return(outStream.ToArray()); } }