Example #1
0
        public void Skip(long offset)
        {
            if (offset < 0 || offset > mLength - mPosition)
            {
                throw new ArgumentOutOfRangeException(nameof(offset));
            }

            while (offset > Int32.MaxValue)
            {
                mReader.Skip(Int32.MaxValue);
                mPosition += Int32.MaxValue;
                offset    -= Int32.MaxValue;
            }

            if (offset > 0)
            {
                mReader.Skip((int)offset);
                mPosition += offset;
            }
        }
Example #2
0
        /// <summary>
        /// Disposes the current stream and moves to the next stream.
        /// </summary>
        public void NextStream()
        {
            if (this.CurrentStreamIndex == this.StreamCount)
            {
                throw new InvalidOperationException("The reader contains no more streams.");
            }

            var remaining = CurrentStreamLength - CurrentStreamPosition;

            CloseCurrentStream();

            while (remaining > Int32.MaxValue)
            {
                mDecodedStream.Skip(Int32.MaxValue);
                remaining -= Int32.MaxValue;
            }

            if (remaining > 0)
            {
                mDecodedStream.Skip((int)remaining);
            }

            mIndex++;
        }