ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Skip C# (CSharp) 메소드

Skip() 공개 메소드

Skip specified number of bytes of uncompressed data
/// The number of bytes to skip is less than or equal to zero. ///
public Skip ( long count ) : long
count long /// Number of bytes to skip ///
리턴 long
        public long Skip(long count)
        {
            if (count <= 0) {
                throw new ArgumentOutOfRangeException(nameof(count));
            }

            // v0.80 Skip by seeking if underlying stream supports it...
            if (baseInputStream.CanSeek) {
                baseInputStream.Seek(count, SeekOrigin.Current);
                return count;
            } else {
                int length = 2048;
                if (count < length) {
                    length = (int)count;
                }

                byte[] tmp = new byte[length];
                int readCount = 1;
                long toSkip = count;

                while ((toSkip > 0) && (readCount > 0)) {
                    if (toSkip < length) {
                        length = (int)toSkip;
                    }

                    readCount = baseInputStream.Read(tmp, 0, length);
                    toSkip -= readCount;
                }

                return count - toSkip;
            }
        }