ICSharpCode.SharpZipLib.Zip.Compression.DeflaterEngine.SetInput C# (CSharp) Method

SetInput() public method

Sets input data to be deflated. Should only be called when NeedsInput() returns true
public SetInput ( byte buffer, int offset, int count ) : void
buffer byte The buffer containing input data.
offset int The offset of the first byte of data.
count int The number of bytes of data to use as input.
return void
        public void SetInput(byte[] buffer, int offset, int count)
        {
            if (buffer == null) {
                throw new ArgumentNullException(nameof(buffer));
            }

            if (offset < 0) {
                throw new ArgumentOutOfRangeException(nameof(offset));
            }

            if (count < 0) {
                throw new ArgumentOutOfRangeException(nameof(count));
            }

            if (inputOff < inputEnd) {
                throw new InvalidOperationException("Old input was not completely processed");
            }

            int end = offset + count;

            /* We want to throw an ArrayIndexOutOfBoundsException early.  The
            * check is very tricky: it also handles integer wrap around.
            */
            if ((offset > end) || (end > buffer.Length)) {
                throw new ArgumentOutOfRangeException(nameof(count));
            }

            inputBuf = buffer;
            inputOff = offset;
            inputEnd = end;
        }

Usage Example

Example #1
0
 public void SetInput(byte[] input, int offset, int count)
 {
     if ((state & 8) != 0)
     {
         throw new InvalidOperationException("Finish() already called");
     }
     engine.SetInput(input, offset, count);
 }
All Usage Examples Of ICSharpCode.SharpZipLib.Zip.Compression.DeflaterEngine::SetInput