Пример #1
0
            private void MaybeSeek()
            {
                if (seekPending)
                {
                    if (pendingFP != lastBlockFP)
                    {
                        // need new block
                        input.Seek(pendingFP);
                        blockReader.Seek(pendingFP);
                        lastBlockFP = pendingFP;
                        blockSize   = blockReader.ReadBlock();
                    }
                    upto = pendingUpto;

                    // TODO: if we were more clever when writing the
                    // index, such that a seek point wouldn't be written
                    // until the int encoder "committed", we could avoid
                    // this (likely minor) inefficiency:

                    // This is necessary for int encoders that are
                    // non-causal, ie must see future int values to
                    // encode the current ones.
                    while (upto >= blockSize)
                    {
                        upto       -= blockSize;
                        lastBlockFP = input.Position; // LUCENENET specific: Renamed from getFilePointer() to match FileStream
                        blockSize   = blockReader.ReadBlock();
                    }
                    seekPending = false;
                }
            }
Пример #2
0
        internal void MaybeSeek()
        {
            if (!_seekPending)
            {
                return;
            }

            if (_pendingFp != _lastBlockFp)
            {
                // need new block
                _input.Seek(_pendingFp);
                _lastBlockFp = _pendingFp;
                _blockReader.Seek(_pendingFp);
                _blockSize = _blockReader.ReadBlock();
            }
            _upto = _pendingUpto;

            // TODO: if we were more clever when writing the
            // index, such that a seek point wouldn't be written
            // until the int encoder "committed", we could avoid
            // this (likely minor) inefficiency:

            // This is necessary for int encoders that are
            // non-causal, ie must see future int values to
            // encode the current ones.
            while (_upto >= _blockSize)
            {
                _upto       -= _blockSize;
                _lastBlockFp = _input.FilePointer;
                _blockSize   = _blockReader.ReadBlock();
            }
            _seekPending = false;
        }
Пример #3
0
 public override int Next()
 {
     if (seekPending)
     {
         // Seek & load new block
         input.Seek(pendingFP);
         lastBlockFP = pendingFP;
         blockReader.ReadBlock();
         seekPending = false;
     }
     else if (upto == blockSize)
     {
         // Load new block
         lastBlockFP = input.Position; // LUCENENET specific: Renamed from getFilePointer() to match FileStream
         blockReader.ReadBlock();
         upto = 0;
     }
     return(pending[upto++]);
 }
Пример #4
0
 public override int Next()
 {
     if (seekPending)
     {
         // Seek & load new block
         input.Seek(pendingFP);
         lastBlockFP = pendingFP;
         blockReader.ReadBlock();
         seekPending = false;
     }
     else if (upto == blockSize)
     {
         // Load new block
         lastBlockFP = input.GetFilePointer();
         blockReader.ReadBlock();
         upto = 0;
     }
     return(pending[upto++]);
 }