GetDeflateOutput() 개인적인 메소드

private GetDeflateOutput ( byte outputBuffer ) : int
outputBuffer byte
리턴 int
예제 #1
0
 private void WriteDeflaterOutput()
 {
     while (!_deflater.NeedsInput())
     {
         int compressedBytes = _deflater.GetDeflateOutput(_buffer);
         if (compressedBytes > 0)
         {
             _stream.Write(_buffer, 0, compressedBytes);
         }
     }
 }
예제 #2
0
        internal void InternalWrite(byte[] array, int offset, int count, bool isAsync)
        {
            int currentOffest  = offset;
            int remainingCount = count;
            int bytesCompressed;

            // compressed the bytes we already passed to the deflater
            while (!deflater.NeedsInput())
            {
                bytesCompressed = deflater.GetDeflateOutput(buffer);
                if (bytesCompressed != 0)
                {
                    if (isAsync)
                    {
                        IAsyncResult result = _stream.BeginWrite(buffer, 0, bytesCompressed, null, null);
                        _stream.EndWrite(result);
                    }
                    else
                    {
                        _stream.Write(buffer, 0, bytesCompressed);
                    }
                }
            }

            deflater.SetInput(array, offset, count);

            // compressed the new input
            while (!deflater.NeedsInput())
            {
                bytesCompressed = deflater.GetDeflateOutput(buffer);
                if (bytesCompressed != 0)
                {
                    if (isAsync)
                    {
                        IAsyncResult result = _stream.BeginWrite(buffer, 0, bytesCompressed, null, null);
                        _stream.EndWrite(result);
                    }
                    else
                    {
                        _stream.Write(buffer, 0, bytesCompressed);
                    }
                }
            }
        }