protected OffsettableStream Decompress(Stream stream, long offset, int allocsize) { stream.Seek(offset, SeekOrigin.Begin); using (ZlibStream zstream = new ZlibStream(stream, CompressionMode.Decompress, true)) { OffsettableMemoryStream outstrm = new OffsettableMemoryStream(allocsize); zstream.CopyTo(outstrm); outstrm.Position = 0; TotalSize = (int)zstream.TotalOut; CompressedSize = (int)zstream.TotalIn; this.DataLength = TotalSize; return outstrm; } }
protected OffsettableStream Decompress(Stream stream, long offset, int allocsize) { stream.Seek(offset, SeekOrigin.Begin); using (ZlibStream zstream = new ZlibStream(stream, CompressionMode.Decompress, true)) { OffsettableMemoryStream outstrm = new OffsettableMemoryStream(allocsize); zstream.CopyTo(outstrm); outstrm.Position = 0; TotalSize = (int)zstream.TotalOut; CompressedSize = (int)zstream.TotalIn; this.DataLength = TotalSize; return(outstrm); } }