public BrutePackBlock?CompressBlock(byte[] data, int length) { var memStream = new MemoryStream(); ArithmeticCoder.EncodeBlockStream(data, memStream, length, InnerChunkSize); if (memStream.Position >= 1024 * 1024 * 2) { return(null); } return(new BrutePackBlock(BlockType.Arithmetic, memStream.ToArray())); }
public byte[] Decompress(BrutePackBlock block) { return(ArithmeticCoder.DecodeBlockStream(new MemoryStream(block.BlockData))); }