SevenZipSharp/SevenZip/LzmaEncodeStream.cs
/// <summary>
/// Writes a sequence of bytes to the current stream and compresses it if necessary.
/// </summary>
/// <param name="buffer">An array of bytes.</param>
/// <param name="offset">The zero-based byte offset in buffer at which to begin storing the data read from the current stream.</param>
/// <param name="count">The maximum number of bytes to be read from the current stream.</param>
Writes a sequence of bytes to the current stream and compresses it if necessary.
Writes a sequence of bytes to the current stream and compresses it if necessary .
public override void Write(byte[] buffer, int offset, int count)
        {
            DisposedCheck();
            int dataLength = Math.Min(buffer.Length - offset, count);
            while (_buffer.Position + dataLength >= _bufferCapacity)
            {
                int length = _bufferCapacity - (int) _buffer.Position;
                _buffer.Write(buffer, offset, length);
                offset = length + offset;
                dataLength -= length;
                WriteChunk();
            }
            _buffer.Write(buffer, offset, dataLength);
        }
public override void Write ( byte [ ] buffer , int offset , int count ) { DisposedCheck ( ) ; int dataLength = Math . Min ( buffer . Length - offset , count ) ; while ( _buffer . Position + dataLength >= _bufferCapacity ) { int length = _bufferCapacity - ( int ) _buffer . Position ; _buffer . Write ( buffer , offset , length ) ; offset = length + offset ; dataLength -= length ; WriteChunk ( ) ; } _buffer . Write ( buffer , offset , dataLength ) ; }
Writes a sequence of bytes to the current stream and compresses it if necessary.
Writes a sequence of bytes to the current stream and compresses it if necessary .
buffer
byte[]
An array of bytes.
An array of bytes .
offset
int
The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
The zero - based byte offset in buffer at which to begin storing the data read from the current stream .
count
int
The maximum number of bytes to be read from the current stream.
The maximum number of bytes to be read from the current stream .