List data of a ftp connection

@return FTPCLient
@throws PageException
@throws IOException
775599
private AFTPClient actionListDir() throws PageException, IOException {
	required("name", name);
	required("directory", directory);

	AFTPClient client = getClient();
	FTPFile[] files = client.listFiles(directory);
	if (files == null) files = new FTPFile[0];

	pageContext.setVariable(name, toQuery(files, "ftp", directory, client.getRemoteAddress().getHostName()));
	writeCfftp(client);
	return client;
    }
887447
public function index()
    {
        $page = $this->request->getQuery('page', 1);

        $this->paginate['order'] = ['tag' => 'ASC'];

        //Limit X4
        $this->paginate['limit'] = $this->paginate['maxLimit'] = $this->paginate['limit'] * 4;

        //Sets the cache name
        $cache = sprintf('tags_limit_%s_page_%s', $this->paginate['limit'], $page);

        //Tries to get data from the cache
        list($tags, $paging) = array_values(Cache::readMany(
            [$cache, sprintf('%s_paging', $cache)],
            $this->PostsTags->getCacheName()
        ));

        //If the data are not available from the cache
        if (empty($tags) || empty($paging)) {
            $query = $this->PostsTags->Tags->find('active');
            $tags = $this->paginate($query);

            //Writes on cache
            Cache::writeMany([
                $cache => $tags,
                sprintf('%s_paging', $cache) => $this->request->getParam('paging'),
            ], $this->PostsTags->getCacheName());
        //Else, sets the paging parameter
        } else {
            $this->request = $this->request->withParam('paging', $paging);
        }

        $this->set(compact('tags'));
    }
1158229
public function getShopList($pageindex = 1, $pagesize = 2)
    {
        $url = 'https://api.weixin.qq.com/bizwifi/shop/list?access_token=ACCESS_TOKEN';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['pageindex' => $pageindex, 'pagesize' => $pagesize]);
    }
1228432
public String getContent() throws ConnectionException {
    	
    	logger.debug("Enter Response::getContent");	
    	
    	if (content != null) {
    		logger.debug("content already available ");
            return content;
        }

    	BufferedReader rd = new BufferedReader(new InputStreamReader(stream));
		StringBuffer result = new StringBuffer();
		String line = "";
		try {
			while ((line = rd.readLine()) != null) {
			    result.append(line);
			}
		} catch (IOException e) {
			logger.error("Exception while retrieving content", e);
            throw new ConnectionException(e.getMessage());
		}
		content = result.toString();
		logger.debug("End Response::getContent");	
		return content;
        
    }
572956
public function listWorksheetInfo($pFilename)
    {
        // Open file
        $this->openFile($pFilename);
        if (!$this->isValidFormat()) {
            fclose($this->fileHandle);
            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
        }
        $fileHandle = $this->fileHandle;

        // Skip BOM, if any
        $this->skipBOM();

        $escapeEnclosures = array( "\\" . $this->enclosure, $this->enclosure . $this->enclosure );

        $worksheetInfo = array();
        $worksheetInfo[0]['worksheetName'] = 'Worksheet';
        $worksheetInfo[0]['lastColumnLetter'] = 'A';
        $worksheetInfo[0]['lastColumnIndex'] = 0;
        $worksheetInfo[0]['totalRows'] = 0;
        $worksheetInfo[0]['totalColumns'] = 0;

        // Loop through each line of the file in turn
        while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) {
            $worksheetInfo[0]['totalRows']++;
            $worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1);
        }

        $worksheetInfo[0]['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']);
        $worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1;

        // Close file
        fclose($fileHandle);

        return $worksheetInfo;
    }
600131
private function getData()
    {
        $data = fgets($this->socket);
        if ($data === false || $data === '') {
            throw new ConnectionException('Nothing received while reading from client');
        }
        return $data;
    }
6392
static public void listContentStream(File pdfFile, PrintWriter out) throws IOException {
        PdfReader reader = new PdfReader(pdfFile.getCanonicalPath());
            
        int maxPageNum = reader.getNumberOfPages();
        
        for (int pageNum = 1; pageNum <= maxPageNum; pageNum++){
            listContentStreamForPage(reader, pageNum, out);
        }       
            
    }
1263129
public function jsonRows()
    {
        $arrWhat = array_values($this->getHeaderColumns());
        $arrWhere = [];
        $arrOrder = ['`id` DESC'];
        $start = 0;
        $pageSize = 15;
        if (isset($_POST['page']) && isset($_POST['pageSize'])) {
            $page = (int) $_POST['page'];
            $pageSize = (int) $_POST['pageSize'];
            $start = $page * $pageSize;
        }
        if (isset($_POST['sort']) && isset($_POST['sortDir'])) {
            $sort = (string) $_POST['sort'];
            $sortDir = (string) $_POST['sortDir'];
            if (!in_array($sortDir, ['ASC', 'DESC'])) {
                throw new Exception('Someone is doing something evil here :(');
            }
            if (!in_array($sort, $this->getAllowedPostColumns())) {
                throw new Exception('Someone is doing something evil here :(');
            }
            $arrOrder = ['`'.$sort.'` '.$sortDir];
        }
        foreach ($arrWhat as $filter) {
            if (in_array($filter, $arrWhat) && isset($_POST['filter_'.$filter])) {
                $arrWhere[$filter] = [
                    "operator" => "like",
                    "value" => '%'.$_POST['filter_'.$filter].'%'
                ];
            }
        }
        
        $arrLimit = [$start, $pageSize];
        $rows = $this->loadByPrepStmt($arrWhat, $arrWhere, $arrOrder, $arrLimit);
        if (count($rows) < 1) {
            return "[]";
        }
        foreach ($rows as $key => $columns) {
            foreach ($columns as $cKey => $column) {
                if ($cKey == "createDate") {
                    $rows[$key][$cKey] = strftime("%d.%m.%Y %H:%M:%S", strtotime($column));
                }
            }
            $rows[$key]['actions'] = $this->renderActionLinks();
        }
        $json = json_encode($rows, JSON_UNESCAPED_UNICODE);
        return $json;
    }
403514
protected FTPWrap _get(FTPConnection conn) throws IOException, ApplicationException {
	FTPWrap wrap = null;

	if (!conn.hasLoginData()) {
	    if (StringUtil.isEmpty(conn.getName())) {
		throw new ApplicationException("can't connect ftp server, missing connection definition");
	    }

	    wrap = wraps.get(conn.getName());
	    if (wrap == null) {
		throw new ApplicationException("can't connect ftp server, missing connection [" + conn.getName() + "]");
	    }
	    else if (!wrap.getClient().isConnected() || wrap.getConnection().getTransferMode() != conn.getTransferMode()) {
		wrap.reConnect(conn.getTransferMode());
	    }
	    return wrap;
	}
	String name = conn.hasName() ? conn.getName() : "__noname__";

	wrap = wraps.get(name);
	if (wrap != null) {
	    if (conn.loginEquals(wrap.getConnection())) {
		return _get(new FTPConnectionImpl(name, null, null, null, conn.getPort(), conn.getTimeout(), conn.getTransferMode(), conn.isPassive(), conn.getProxyServer(),
			conn.getProxyPort(), conn.getProxyUser(), conn.getProxyPassword(), conn.getFingerprint(), conn.getStopOnError(), conn.secure()));
	    }
	    disconnect(wrap.getClient());
	}

	wrap = new FTPWrap(conn);
	wraps.put(name, wrap);

	return wrap;
    }
1030173
public function findPage()
    {
        $data['data'] = $this->findAll();
        $data['data_count'] = $this->conn()->selectCollection($this->table_name)->count();

        return $data;
    }
269571
private void buildData(String path, WebPage page, List<TreePageData> data, WebSiteRequest req) throws IOException, SQLException {
		if(isVisible(page)) {
			if(path.length()>0) path=path+'/'+page.getShortTitle();
			else path=page.getShortTitle();
			WebPage[] pages=page.getCachedPages(req);
			int len=pages.length;
			data.add(
				new TreePageData(
					len>0 ? (path+'/') : path,
					req.getContextPath()+req.getURL(page),
					page.getDescription()
				)
			);
			for(int c=0; c<len; c++) buildData(path, pages[c], data, req);
		}
	}
674655
public function listAction()
    {
        $this->checkAuth($this->resources, $this->modules, AccessManager::VIEW);
        $request = $this->getRequest();

        if ($request->query->has('id')) {
            $request->query->remove('id');
        }

        $params = array_merge(
            $this->defaultLoopArgs,
            $request->query->all()
        );

        try {
            $results = $this->getLoopResults($params);
        } catch (\Exception $e) {
            throw new HttpException(500, json_encode(["error" => $e->getMessage()]));
        }

        return JsonResponse::create($results);
    }
1051305
public function index(): PaginatedDataInterface
    {
        $builder = $this->createIndexModelBuilder();
        $data    = $this->fetchResources($builder, $builder->getModelClass());

        return $data;
    }
657714
private function ftp()
    {
        $servers = static::SERVERS;  // Server list
        // Try each server till success
        $ftp;
        for ($i = 0; $i < count($servers); $i++) {
            $ftpServer = $servers[$i]['domain'];
            $ftp       = ftp_connect($ftpServer);

            // Return resource on connected
            if ($ftp) {
                if (ftp_login($ftp, 'anonymous', null)) {
                    if (ftp_chdir($ftp, $servers[$i]['path'])) {
                        if (ftp_pasv($ftp, true)) {
                            return $ftp;
                        }
                    }
                }
            }
        }

        // Unable to connect to a server
        throw new \Exception('Unable to connect to server to download data');
    }
1021675
public function getData()
    {
        $limit = $this->getLimit();
        $this->setHeaders();
        $page  = $this->getPage();
        if ($page > 0) {
            $page-=1;
        }
        return $this->getDataSource()->limit($limit)->offset($limit * $page)->getAll();
    }
1317862
protected function clientRenderPages()
    {
        /** @var TClientUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $result = $page->pages($this->pagesCount, $this->settings['itemsPerPage'],
            $this->table['sortDesc']);
        return $result;
    }
569315
private List<T> computePagedList(List<T> result, HeaderAndBody httpResponse, JSONObject where, Pipe<T> requestingPipe) {
        ReadFilter previousRead = null;
        ReadFilter nextRead = null;

        if (PageConfig.MetadataLocations.WEB_LINKING.equals(pageConfig.getMetadataLocation())) {
            String webLinksRaw = "";
            final String relHeader = "rel";
            final String nextIdentifier = pageConfig.getNextIdentifier();
            final String prevIdentifier = pageConfig.getPreviousIdentifier();
            try {
                webLinksRaw = getWebLinkHeader(httpResponse);
                if (webLinksRaw == null) { // no paging, return result
                    return result;
                }
                List<WebLink> webLinksParsed = WebLinkParser.parse(webLinksRaw);
                for (WebLink link : webLinksParsed) {
                    if (nextIdentifier.equals(link.getParameters().get(relHeader))) {
                        nextRead = new ReadFilter();
                        nextRead.setLinkUri(new URI(link.getUri()));
                    } else if (prevIdentifier.equals(link.getParameters().get(relHeader))) {
                        previousRead = new ReadFilter();
                        previousRead.setLinkUri(new URI(link.getUri()));
                    }

                }
            } catch (URISyntaxException ex) {
                Log.e(TAG, webLinksRaw + " did not contain a valid context URI", ex);
                throw new RuntimeException(ex);
            } catch (ParseException ex) {
                Log.e(TAG, webLinksRaw + " could not be parsed as a web link header", ex);
                throw new RuntimeException(ex);
            }
        } else if (pageConfig.getMetadataLocation().equals(PageConfig.MetadataLocations.HEADERS)) {
            nextRead = pageConfig.getPageParameterExtractor().getNextFilter(httpResponse, RestAdapter.this.pageConfig);
            previousRead = pageConfig.getPageParameterExtractor().getPreviousFilter(httpResponse, RestAdapter.this.pageConfig);
        } else if (pageConfig.getMetadataLocation().equals(PageConfig.MetadataLocations.BODY)) {
            nextRead = pageConfig.getPageParameterExtractor().getNextFilter(httpResponse, RestAdapter.this.pageConfig);
            previousRead = pageConfig.getPageParameterExtractor().getPreviousFilter(httpResponse, RestAdapter.this.pageConfig);
        } else {
            throw new IllegalStateException("Not supported");
        }
        if (nextRead != null) {
            nextRead.setWhere(where);
        }

        if (previousRead != null) {
            previousRead.setWhere(where);
        }

        return new WrappingPagedList<T>(requestingPipe, result, nextRead, previousRead);
    }