Reads in a page.

@return true if a page was read, false if we've reached the end of the stream.
189797
protected boolean readPage ()
        throws IOException
    {
        int result;
        while ((result = _sync.pageout(_page)) != 1) {
            if (result == 0 && !readChunk()) {
                return false;
            }
        }
        _stream.pagein(_page);
        return true;
    }
1050798
private boolean before() throws IOException {
        if (closed) {
            throw new IOException("Attempted read from closed stream.");
        }
        switch (length) {
            case EOF:
                return false;
            case UNKNOWN:
                length = readLength();
                pos = 0;
                if (length == EOF) {
                    HeaderList.parse(src); // result is ignored
                    return false;
                }
                return true;
            default:
                return true;
        }
    }
335055
protected boolean lookahead() {
        assert next == null : "looking ahead when next is already loaded";
        while(inner.hasNext()) {
            next = transform(inner.next());
            if(next!=null) {
                return true;
            }
        }
        noteExhausted();
        return false;
    }
1169065
public boolean newPage() {
        if (!open || close) {
            return false;
        }
        DocListener listener;
		for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
            listener = (DocListener) iterator.next();
            listener.newPage();
        }
        return true;
    }
333729
private boolean getPageAndPacket() {
		// grab some data at the head of the stream.  We want the first page
        // (which is guaranteed to be small and only contain the Vorbis
        // stream initial header) We need the first page to get the stream
        // serialno.

        // submit a 4k block to libvorbis' Ogg layer
        int index = syncState.buffer(4096);

        buffer = syncState.data;
        if (buffer == null) {
            endOfStream = true;
            return false;
        }

        try {
            bytes = input.read(buffer, index, 4096);
        } catch (Exception e) {
            logger.log(Level.WARNING, "Failure reading in vorbis", e);
            endOfStream = true;
            return false;
        }
        syncState.wrote(bytes);

        // Get the first page.
        if (syncState.pageout(page) != 1) {
            // have we simply run out of data?  If so, we're done.
            if (bytes < 4096) {
                return false;
            }

            // error case.  Must not be Vorbis data
            logger.log(Level.WARNING, "Input does not appear to be an Ogg bitstream.");
            endOfStream = true;
            return false;
        }

		// Get the serial number and set up the rest of decode.
        // serialno first; use it to set up a logical stream
        streamState.init(page.serialno());

		// extract the initial header from the first page and verify that the
        // Ogg bitstream is in fact Vorbis data
		// I handle the initial header first instead of just having the code
        // read all three Vorbis headers at once because reading the initial
        // header is an easy way to identify a Vorbis bitstream and it's
        // useful to see that functionality seperated out.
        oggInfo.init();
        comment.init();
        if (streamState.pagein(page) < 0) {
            // error; stream version mismatch perhaps
            logger.log(Level.WARNING, "Error reading first page of Ogg bitstream data.");
            endOfStream = true;
            return false;
        }

        if (streamState.packetout(packet) != 1) {
            // no page? must not be vorbis
            logger.log(Level.WARNING, "Error reading initial header packet.");
            endOfStream = true;
            return false;
        }

        if (oggInfo.synthesis_headerin(comment, packet) < 0) {
            // error case; not a vorbis header
            logger.log(Level.WARNING, "This Ogg bitstream does not contain Vorbis audio data.");
            endOfStream = true;
            return false;
        }

		// At this point, we're sure we're Vorbis.  We've set up the logical
        // (Ogg) bitstream decoder.  Get the comment and codebook headers and
        // set up the Vorbis decoder
		// The next two packets in order are the comment and codebook headers.
        // They're likely large and may span multiple pages.  Thus we reead
        // and submit data until we get our two pacakets, watching that no
        // pages are missing.  If a page is missing, error out; losing a
        // header page is the only place where missing data is fatal. */
        int i = 0;
        while (i < 2) {
            while (i < 2) {

                int result = syncState.pageout(page);
                if (result == 0) {
                    break; // Need more data
                }				// Don't complain about missing or corrupt data yet.  We'll
                // catch it at the packet output phase

                if (result == 1) {
                    streamState.pagein(page); // we can ignore any errors here
                    // as they'll also become apparent
                    // at packetout
                    while (i < 2) {
                        result = streamState.packetout(packet);
                        if (result == 0) {
                            break;
                        }
                        if (result == -1) {
							// Uh oh; data at some point was corrupted or missing!
                            // We can't tolerate that in a header.  Die.
                            logger.log(Level.WARNING, "Corrupt secondary header.  Exiting.");
                            endOfStream = true;
                            return false;
                        }

                        oggInfo.synthesis_headerin(comment, packet);
                        i++;
                    }
                }
            }
            // no harm in not checking before adding more
            index = syncState.buffer(4096);
            buffer = syncState.data;
            try {
                bytes = input.read(buffer, index, 4096);
            } catch (Exception e) {
                logger.log(Level.WARNING, "Failed to read Vorbis: ", e);
                endOfStream = true;
                return false;
            }
            if (bytes == 0 && i < 2) {
                logger.log(Level.WARNING, "End of file before finding all Vorbis headers!");
                endOfStream = true;
                return false;
            }
            syncState.wrote(bytes);
        }

        convsize = 4096 / oggInfo.channels;

		// OK, got and parsed all three headers. Initialize the Vorbis
        //  packet->PCM decoder.
        dspState.synthesis_init(oggInfo); // central decode state
        vorbisBlock.init(dspState); // local state for most of the decode
        // so multiple block decodes can
        // proceed in parallel.  We could init
        // multiple vorbis_block structures
        // for vd here

        return true;
    }
1217766
public boolean hasNext()
  {
    if (tc.isEntryEnabled()) 
      SibTr.entry(tc, "hasNext");
      
    if (tc.isEntryEnabled()) 
      SibTr.exit(tc, "hasNext", Boolean.valueOf(browserIterator.hasNext()));
      
    return browserIterator.hasNext();
  }
231220
@Override
	public boolean hasNext()
		throws ArticleReaderException
	{

		if (super.hasNext()) {

			if (lastTaskCompleted) {
				this.taskStartPosition = this.getBytePosition();
				this.processingTimeRead = 0;
				this.readRevisionCounter = 0;
				this.lastTaskCompleted = false;
			}

			return true;
		}
		return false;
	}
153630
public boolean showPreviousPage() {
		AbstractWizardPage previousPage;
		try {
			previousPage = pageHistory.pop();
		} catch (EmptyStackException e) {
			// Previous page is null. Updating buttons and ignoring request.
			updateButtons();
			return false;
		}
		setPage(previousPage);
		return true;
	}
67549
protected boolean readPacket ()
        throws IOException
    {
        int result;
        while ((result = _stream.packetout(_packet)) != 1) {
            if (result == 0 && !readPage()) {
                return false;
            }
        }
        return true;
    }
84560
@Override
    public int readLine(byte[] b, int off, int len) throws IOException {
        
        //Return -1 here because if we are closed or finished, we're at the end of the stream
        if(isClosed || isFinished()){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "Nothing to read, stream is closed : " + isClosed + ", or finished : " + isFinished());
            return -1;
        }
        
        //We want to prevent readLine calls from going async since they can be unpredictable
        this.readLineCall =  true;
        
        int readLineReturn = super.readLine(b, off, len);
        
        this.readLineCall = false;
        
        return readLineReturn;
    }
537169
@Override
    public int read() throws IOException {
        abortIfNeeded();
        int result;
        // If there are no more available bytes, mark that we are at the end of the stream.
        if (this.virtualAvailable <= 0) {
            result = -1;
        } else {
            // Otherwise, read a byte.
            result = this.decryptedContents.read();
        }

        // If we have not reached the end of the stream, decrement the number of available bytes.
        if (result != -1) {
            this.virtualAvailable--;
        } else {
            // If we are at the end of the stream, close it.
            this.virtualAvailable = 0;
            close();
        }

        return result;
    }
490144
def stream(self, page, limit=None, page_limit=None):
        
        current_record = 1
        current_page = 1

        while page is not None:
            for record in page:
                yield record
                current_record += 1
                if limit and limit is not values.unset and limit < current_record:
                    return

            if page_limit and page_limit is not values.unset and page_limit < current_page:
                return

            page = page.next_page()
            current_page += 1
1227530
public boolean readMore()
    {
        if (this.worker.isDone())
        {
            this.serverCursorExecutor.setCursorDone(this);
        }
        if (queue.size() > getMaxQueueLength() || this.worker.isDone())
        {
            return true;
        }
        this.worker.doWork();
        return false;
    }
1038570
def next_page(self):
        
        if self.is_last_page():
            return False

        self.page += 1
        self.items = self.fetch_items()
        return True
392013
public int read() throws IOException {
        if (end == endFilled) {
            switch (pages.read(endPageIdx, endFilled)) {
                case -1:
                    eof = true;
                    return Scanner.EOF;
                case 0:
                    endFilled = pages.getFilled(endPageIdx);
                    break;
                case 1:
                    endPageIdx++;
                    end = 0;
                    endPage = pages.get(endPageIdx);
                    endFilled = pages.getFilled(endPageIdx);
                    break;
                default:
                    throw new RuntimeException();
            }
        }
        return endPage[end++];
    }
716651
public synchronized boolean hasNext()
    {
        if (position < length)
        {
            if (position < scrolled)
            {
             	return true;
            }
            else
            {
                boolean result = ojbIterator.hasNext();
             	return result;
            }
        }
        else
        {
			releaseJdbcResources();
            return false;
        }

    }
7776
@Override
    public int read(byte[] buffer, int offset, int length) throws IOException {
        abortIfNeeded();
        int numBytesRead;
        // If no more bytes are available, do not read any bytes into the buffer
        if(this.virtualAvailable <= 0) {
            numBytesRead = -1;
        } else {
            // If the desired read length is greater than the number of available bytes,
            // shorten the read length to the number of available bytes.
            if(length > this.virtualAvailable) {
                // If the number of available bytes is greater than the maximum value of a 32 bit int, then
                // read as many bytes as an int can.
                length = (this.virtualAvailable < Integer.MAX_VALUE) ? (int)this.virtualAvailable : Integer.MAX_VALUE;
            }
            // Read bytes into the buffer.
            numBytesRead = this.decryptedContents.read(buffer, offset, length);
        }
        // If we were able to read bytes, decrement the number of bytes available to be read.
        if(numBytesRead != -1) {
            this.virtualAvailable -= numBytesRead;
        } else {
            // If we've reached the end of the stream, close it
            this.virtualAvailable = 0;
            close();
        }
        return numBytesRead;
    }