Exemplo n.º 1
0
 private static void CheckIndexBounds(int readerIndex, int writerIndex)
 {
     if (readerIndex < 0 || readerIndex > writerIndex)
     {
         ThrowHelper.ThrowIndexOutOfRangeException_ReaderIndex(readerIndex, writerIndex);
     }
 }
Exemplo n.º 2
0
 private static void CheckMinReadableBounds(int minimumReadableBytes, int readerIndex, int writerIndex, AbstractByteBuffer buf)
 {
     if (CheckBounds && (readerIndex > writerIndex - minimumReadableBytes))
     {
         ThrowHelper.ThrowIndexOutOfRangeException_ReaderIndex(minimumReadableBytes, readerIndex, writerIndex, buf);
     }
 }
 void CheckReadableBytes0(int minimumReadableBytes)
 {
     this.EnsureAccessible();
     if (this.readerIndex > this.writerIndex - minimumReadableBytes)
     {
         ThrowHelper.ThrowIndexOutOfRangeException_ReaderIndex(minimumReadableBytes, this.readerIndex, this.writerIndex, this);
     }
 }
        public virtual IByteBuffer SetReaderIndex(int index)
        {
            if (index < 0 || index > this.writerIndex)
            {
                ThrowHelper.ThrowIndexOutOfRangeException_ReaderIndex(index, this.WriterIndex);
            }

            this.readerIndex = index;
            return(this);
        }
        public virtual void AdvanceReader(int count)
        {
            if (count < 0)
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count);
            }

            if (0u >= (uint)count)
            {
                return;
            }

            var readerIdx = _readerIndex + count;
            var writerIdx = _writerIndex;

            if (CheckBounds && readerIdx > writerIdx)
            {
                ThrowHelper.ThrowIndexOutOfRangeException_ReaderIndex(readerIdx, writerIdx);
            }
            _readerIndex = readerIdx;
        }