Examples of FTPListParseEngine


Examples of org.apache.commons.net.ftp.FTPListParseEngine

  }

  private List<String> getUpdatedFilesToDownload() throws IOException {
    long t1 = System.currentTimeMillis();

    FTPListParseEngine engine = _ftpClient.initiateListParsing(_dataDirectory);

    Set<String> paths = new HashSet<String>();
    List<String> toDownload = new ArrayList<String>();

    while (engine.hasNext()) {
      FTPFile[] files = engine.getNext(25); // "page size" you want
      for (FTPFile file : files) {
        String path = _dataDirectory + "/" + file.getName();
        paths.add(path);
        if (!_paths.contains(path))
          toDownload.add(path);
View Full Code Here

Examples of org.apache.commons.net.ftp.FTPListParseEngine

        };
        for (File mlsd : path.listFiles(filter)){
            System.out.println(mlsd);
            InputStream is = new FileInputStream(mlsd);
            FTPListParseEngine engine = new FTPListParseEngine(MLSxEntryParser.getInstance());
            engine.readServerList(is, FTP.DEFAULT_CONTROL_ENCODING);
            FTPFile [] mlsds = engine.getFiles(FTPFileFilters.ALL);
            is.close();
            File list = new File(mlsd.getParentFile(),mlsd.getName().replace("_mlsd", "_list"));

            System.out.println(list);
            is = new FileInputStream(list);
            FTPClientConfig cfg = new FTPClientConfig();
            cfg.setServerTimeZoneId("GMT");
            UnixFTPEntryParser parser = new UnixFTPEntryParser(cfg);
            engine = new FTPListParseEngine(parser);
            engine.readServerList(is, FTP.DEFAULT_CONTROL_ENCODING);
            FTPFile [] lists = engine.getFiles(FTPFileFilters.ALL);
            is.close();
            compareSortedLists(mlsds, lists);
        }
    }
View Full Code Here

Examples of org.apache.commons.net.ftp.FTPListParseEngine

     */
    public void testWholeListParse() throws IOException
    {
        VMSFTPEntryParser parser = new VMSFTPEntryParser();
        parser.configure(null);
        FTPListParseEngine engine = new FTPListParseEngine(parser);
        engine.readServerList(
                new ByteArrayInputStream(fullListing.getBytes()));
        FTPFile[] files = engine.getFiles();
        assertEquals(6, files.length);
        assertFileInListing(files, "2-JUN.LIS");
        assertFileInListing(files, "3-JUN.LIS");
        assertFileInListing(files, "1-JUN.LIS");
        assertFileNotInListing(files, "1-JUN.LIS;1");
View Full Code Here

Examples of org.apache.commons.net.ftp.FTPListParseEngine

    public void testWholeListParseWithVersioning() throws IOException
    {

        VMSFTPEntryParser parser = new VMSVersioningFTPEntryParser();
        parser.configure(null);
        FTPListParseEngine engine = new FTPListParseEngine(parser);
        engine.readServerList(
                new ByteArrayInputStream(fullListing.getBytes()));
        FTPFile[] files = engine.getFiles();
        assertEquals(3, files.length);
        assertFileInListing(files, "1-JUN.LIS;1");
        assertFileInListing(files, "2-JUN.LIS;1");
        assertFileInListing(files, "3-JUN.LIS;4");
        assertFileNotInListing(files, "3-JUN.LIS;1");
View Full Code Here

Examples of org.apache.commons.net.ftp.FTPListParseEngine

     * @deprecated (2.2) No other FTPFileEntryParser implementations have this method.
     * Not currently used by NET code. To be removed in 3.0
     ***/
    @Deprecated
    public FTPFile[] parseFileList(InputStream listStream) throws IOException {
        FTPListParseEngine engine = new FTPListParseEngine(this);
        engine.readServerList(listStream, null);
        return engine.getFiles();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.