Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void readIdBatch0() throws java.io.IOException
        private void ReadIdBatch0()
        {
            if (_stackPosition == 0)
            {
                return;
            }

            long       startPosition = max(_stackPosition - _batchSize * _idEntrySize, 0);
            int        bytesToRead   = toIntExact(_stackPosition - startPosition);
            ByteBuffer readBuffer    = ByteBuffer.allocate(bytesToRead);

            _channel.position(startPosition);
            _channel.readAll(readBuffer);
            _stackPosition = startPosition;

            readBuffer.flip();
            int idsRead = bytesToRead / _idEntrySize;

            for (int i = 0; i < idsRead; i++)
            {
                long id = readBuffer.Long;
                _readFromDisk.enqueue(id);
            }
            if (_aggressiveMode)
            {
                Truncate(startPosition);
            }
        }