Factor method for Call list, returns a list of Call objects with page, size preference
@param page the page
@param size the page size
@return the list
@throws IOException unexpected error.
433085
public static ResourceList<Call> list(final int page, final int size) throws IOException {
    	
        return list(BandwidthClient.getInstance(), page, size);
    }
1186070
public static <T> DataPage<T> getByList(List<T> list, int pageSize, int pageNo) {
        List<T> l = subList(list, pageSize, pageNo);
        return new DataPage<T>(l, list.size(), pageSize, pageNo);
    }
538698
public static int size(String size, int defaultValue) {
        int parseInt = NumUtils.intVal(size, defaultValue);
        return parseInt <= 0 ? defaultValue
                : (parseInt > DEFAULT_MAX_PAGE_SIZE ? DEFAULT_MAX_PAGE_SIZE : parseInt);
    }
1232809
public static ResourceList<AvailableNumber> list(final int page, final int size) throws IOException {
    	        
        return list(BandwidthClient.getInstance(), page, size);
    }
63871
public List<GitlabProject> getProjectsWithPagination(int page, int perPage) throws IOException {
        Pagination pagination = new Pagination()
                .withPage(page)
                .withPerPage(perPage);
        return getProjectsWithPagination(pagination);
    }
1002078
protected byte[] ensureBufferSize(final int size, final Context context){
        if ((context.buffer == null) || (context.buffer.length < context.pos + size)){
            return resizeBuffer(context);
        }
        return context.buffer;
    }
762629
public final List<PrintJobStatusExtImpl> poll(final int size) {
        final CriteriaBuilder builder = getSession().getCriteriaBuilder();
        final CriteriaQuery<PrintJobStatusExtImpl> criteria =
                builder.createQuery(PrintJobStatusExtImpl.class);
        final Root<PrintJobStatusExtImpl> root = criteria.from(PrintJobStatusExtImpl.class);
        root.alias("pj");
        criteria.where(builder.equal(root.get("status"), PrintJobStatus.Status.WAITING));
        criteria.orderBy(builder.asc(root.get("entry").get("startTime")));
        final Query<PrintJobStatusExtImpl> query = getSession().createQuery(criteria);
        query.setMaxResults(size);
        // LOCK but don't wait for release (since this is run continuously
        // anyway, no wait prevents deadlock)
        query.setLockMode("pj", LockMode.UPGRADE_NOWAIT);
        try {
            return query.getResultList();
        } catch (PessimisticLockException ex) {
            // Another process was polling at the same time. We can ignore this error
            return Collections.emptyList();
        }
    }
1368532
public ListRuleResponse listRules(ListRuleRequest request) {
        InternalRequest internalRequest =
                createRequest(request, HttpMethodName.GET, RULES);
        if (request.getPageNo() > 0) {
            internalRequest.addParameter("pageNo", String.valueOf(request.getPageNo()));
        }
        if (request.getPageSize() > 0) {
            internalRequest.addParameter("pageSize", String.valueOf(request.getPageSize()));
        }
        return this.invokeHttpClient(internalRequest, ListRuleResponse.class);
    }
303145
public static ResourceList<Application> list(final int page, final int size) throws IOException {
    	
    	final BandwidthClient client = BandwidthClient.getInstance();
        
        return list(client, page, size);
    }
1120572
public static <E> Matcher<Iterable<E>> hasSize(final int size) {
        checkArgument(size >= 0, "Size cannot be negative");

        return new IsIterableWithSize(size);
    }
453284
public static <T> List<T> subList(final List<T> list, int pageSize, int page) {

		if (pageSize <= 0 || page == 0) {

			return Collections.EMPTY_LIST;
		}

		int size        = list.size();

		int fromIndex   = page > 0
		     ? (page - 1) * pageSize
		     : size + (page * pageSize);

		int toIndex = fromIndex + pageSize;

		int finalFromIndex = Math.max(0, fromIndex);
		int finalToIndex   =  Math.min(size, Math.max(0, toIndex));

		// prevent fromIndex to be greater than toIndex
		if (finalFromIndex > finalToIndex) {
			finalFromIndex = finalToIndex;
		}

		try {
			return list.subList(finalFromIndex, finalToIndex);

		} catch (Throwable t) {

			logger.warn("Invalid range for sublist in paging, pageSize {}, page {}: {}", new Object[] {
				pageSize,
				page,
				t.getMessage()
			});
		}

		return Collections.EMPTY_LIST;

	}
71273
public static <T> List<List<T>> split(final Collection<? extends T> c, final int size) {
        if (size < 1) {
            throw new IllegalArgumentException("The parameter 'size' can not be zero or less than zero");
        }

        if (N.isNullOrEmpty(c)) {
            return new ArrayList<>();
        }

        return split(c, 0, c.size(), size);
    }
479235
private byte[] getContentBytesForPage(int pageNum) throws IOException {
        RandomAccessFileOrArray f = reader.getSafeFile();
        byte[] contentBytes = reader.getPageContent(pageNum, f);
        f.close();
        return contentBytes;
    }
629927
public String getTextFromPage(int page) throws IOException {
    	int totalPages = reader.getNumberOfPages();
    	if (totalPages < page) {
    		throw new IOException("indicated page does not exists, requested page " + page + " document pages " + totalPages);
    	}
    	if (page <= 0) {
    		throw new IOException("page number must be postive:" + page);
    	}
        PdfDictionary pageDic = reader.getPageN(page);
		if (pageDic == null) {
			return "";
		}
        PdfDictionary resourcesDic = pageDic.getAsDict(PdfName.RESOURCES);
        extractionProcessor.processContent(getContentBytesForPage(page), resourcesDic);        
        return extractionProcessor.getResultantText();
    }
566678
@Override
    public Page<PhoneNumber> nextPage(final Page<PhoneNumber> page, 
                                      final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getNextPageUrl(
                Domains.TRUNKING.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }
1099177
public static <T> List<T> page(int pageNo, int pageSize, List<T> list) {
		if (isEmpty(list)) {
			return new ArrayList<>(0);
		}

		int resultSize = list.size();
		// 每页条目数大于总数直接返回所有
		if (resultSize <= pageSize) {
			if (pageNo <= 1) {
				return Collections.unmodifiableList(list);
			} else {
				// 越界直接返回空
				return new ArrayList<>(0);
			}
		}
		final int[] startEnd = PageUtil.transToStartEnd(pageNo, pageSize);
		if (startEnd[1] > resultSize) {
			startEnd[1] = resultSize;
		}
		return list.subList(startEnd[0], startEnd[1]);
	}
1131124
public function page($page, $size) {
        if ( $page <= 0 ) $page = 1;
        $offset = ($page-1) * $size;
        return $this->offset($offset, $size);
    }