Get a page and packet from that page

@return True if there was a page available
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;
    }
215062
public boolean pages_isAppAdded(Long pageId)
    throws FacebookException, IOException {
    return extractBoolean(this.callMethod(FacebookMethod.PAGES_IS_APP_ADDED,
                                          new Pair<String,CharSequence>("page_id", pageId.toString())));
  }
669688
def has_page?(url)
      schemes = %w(http https)
      if schemes.include? url.scheme
        u = url.dup
        return schemes.any? { |s| u.scheme = s; has_key?(u) }
      end

      has_key? url
    end
546237
public function getPage() {
    $page = $this->traverse($this->pageMap, Server::getRequestUriParts());
    if ($page === null) {
      return null;
    }
    return $this->createWebPageFromClassName($page);
  }
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;
    }
368543
public List<Page> getPages() {
        Collection collection = collections.get("page");
        if (collection != null) {
            List<Page> pages = collection.getPages();
            return ImmutableList.copyOf(pages);
        }
        return Collections.emptyList();
    }
422857
public @NotNull List<Page> getPages(@Nullable final Predicate<Page> filter, @Nullable final Page basePage) {
    Resource baseResourceToUse = null;

    // detect pages page to use
    if (basePage == null) {
      PageManager pageManager = AdaptTo.notNull(request.getResourceResolver(), PageManager.class);
      Page currentPage = pageManager.getContainingPage(request.getResource());
      if (currentPage != null) {
        baseResourceToUse = currentPage.adaptTo(Resource.class);
      }
    }
    else {
      baseResourceToUse = basePage.adaptTo(Resource.class);
    }

    // filter pages (as resources)
    Predicate<Resource> resourceFilter = new Predicate<Resource>() {
      @Override
      public boolean test(Resource resource) {
        Page page = resource.adaptTo(Page.class);
        if (page == null) {
          return false;
        }
        if (filter == null) {
          return true;
        }
        return filter.test(page);
      }
    };
    List<Resource> resources = getResourcesWithBaseResource(resourceFilter, baseResourceToUse);

    // convert resources back to pages
    return Lists.transform(resources, new Function<Resource, Page>() {
      @Override
      @SuppressWarnings("null")
      public Page apply(@Nullable Resource resource) {
        return resource.adaptTo(Page.class);
      }
    });
  }
153126
public @NotNull List<Page> getPages() {
    return getPages((Predicate<Page>)null, (Page)null);
  }
269607
public boolean isFullyLoaded(Protocol protocol) {
    if (fetchSize == 0 || resultSet == null) {
      return true;
    }
    return resultSet.isFullyLoaded()
            && executionResults.isEmpty()
            && !protocol.hasMoreResults();
  }
972004
function getPage( i ) {
		options.path = urlpath({
			'pathname': opts.pathname,
			'page': i,
			'per_page': opts.per_page,
			'query': opts.query
		});
		debug( 'Request path: %s', options.path );

		debug( 'Attempting to resolve page %d.', i );
		request( options, onPage );
	}
50724
public boolean hasSearchPages() {
		try {
			return this.getClass().getMethod("createSearchPage", new Class<?>[] { String.class }).getDeclaringClass() != Application.class;
		} catch (NoSuchMethodException | SecurityException e) {
			throw new RuntimeException(e);
		}
	}
541758
public Integer getPerPage() {
		int ret = 0;
		if (photos != null) {
			int pp;
			if (photos.perpage == null) {
				pp = 0;
			} else {
				pp = photos.perpage;
			}

			int pP;
			if (photos.perPage == null ) {
				pP = 0;
			} else {
				pP = photos.perPage;
			}

			if (pp > pP) {
				ret = pp;
			} else {
				ret = pP;
			}
		}
		return ret;
	}
1324038
protected boolean isWeb() {
		ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
		if (attributes == null) {
			return false;
		}
		HttpServletRequest request = attributes.getRequest();
		if (request == null) {
			return false;
		}
		return true;
	}
714963
protected function Page()
    {
        if (!$this->page) {
            $this->page = new Page(Request::GetData('page'));
        }
        return $this->page;
    }
1179615
private boolean loadPagesIfNecessary(PagesSupplier pagesSupplier, DataSize maxSize)
    {
        checkState(!Thread.holdsLock(this), "Can not load pages while holding a lock on this");

        boolean dataAddedOrNoMorePages;
        List<SerializedPageReference> pageReferences;
        synchronized (this) {
            if (noMorePages) {
                return false;
            }

            if (!pages.isEmpty()) {
                return false;
            }

            // The page supplier has incremented the page reference count, and addPages below also increments
            // the reference count, so we need to drop the page supplier reference. The call dereferencePage
            // is performed outside of synchronized to avoid making a callback while holding a lock.
            pageReferences = pagesSupplier.getPages(maxSize);

            // add the pages to this buffer, which will increase the reference count
            addPages(pageReferences);

            // check for no more pages
            if (!pagesSupplier.mayHaveMorePages()) {
                noMorePages = true;
            }
            dataAddedOrNoMorePages = !pageReferences.isEmpty() || noMorePages;
        }

        // sent pages will have an initial reference count, so drop it
        pageReferences.forEach(SerializedPageReference::dereferencePage);

        return dataAddedOrNoMorePages;
    }
603937
public Object getPage(long pagePlusOffsetAddress) {
    if (tungstenMemoryMode == MemoryMode.ON_HEAP) {
      final int pageNumber = decodePageNumber(pagePlusOffsetAddress);
      assert (pageNumber >= 0 && pageNumber < PAGE_TABLE_SIZE);
      final MemoryBlock page = pageTable[pageNumber];
      assert (page != null);
      assert (page.getBaseObject() != null);
      return page.getBaseObject();
    } else {
      return null;
    }
  }
11505
public function getNext()
    {
        if (count($this->pagination) == 0) {
            $this->get();
        }
        
        if ($this->page < $this->pagination['total_pages']) {
            $this->page++;
            return $this->get();
        }
        
        return false;
    }