internal bool Finish(IntPtr buffer, int count, out int bytesRead) { Debug.Assert(NeedsInput(), "We have something left in previous input!"); // Note: we require that NeedsInput() == true, i.e. that 0 == _zlibStream.AvailIn. // If there is still input left we should never be getting here; instead we // should be calling GetDeflateOutput. ZErrorCode errC = ReadDeflateOutput(buffer, count, ZFlushCode.Finish, out bytesRead); return(errC == ZErrorCode.StreamEnd); }
private unsafe ZErrorCode ReadDeflateOutput(IntPtr buffer, int count, ZFlushCode flushCode, out int bytesRead) { lock (_syncLock) { _zlibStream.NextOut = buffer; _zlibStream.AvailOut = (uint)count; ZErrorCode errC = Deflate(flushCode); bytesRead = count - (int)_zlibStream.AvailOut; return(errC); } }
private void Init(string zlibErrorContext, ZErrorCode zlibErrorCode, string zlibErrorMessage) { _zlibErrorContext = zlibErrorContext; _zlibErrorCode = zlibErrorCode; _zlibErrorMessage = zlibErrorMessage; }