private FTPListParseEngine initiateListParsing(FTPFileEntryParser parser, String pathname) throws IOException { Socket socket = this._openDataConnection_(26, this.getListArguments(pathname)); FTPListParseEngine engine = new FTPListParseEngine(parser); if(socket == null) { return engine; } else { try { engine.readServerList(socket.getInputStream(), this.getControlEncoding()); } finally { Util.closeQuietly(socket); } this.completePendingCommand(); return engine; } }
private FTPListParseEngine initiateMListParsing(String pathname) throws IOException { Socket socket = this._openDataConnection_(38, pathname); FTPListParseEngine engine = new FTPListParseEngine(MLSxEntryParser.getInstance()); if(socket == null) { return engine; } else { try { engine.readServerList(socket.getInputStream(), this.getControlEncoding()); } finally { Util.closeQuietly(socket); this.completePendingCommand(); } return engine; } }
/** @deprecated */ @Deprecated public FTPFile[] parseFileList(InputStream listStream) throws IOException { FTPListParseEngine engine = new FTPListParseEngine(this); engine.readServerList(listStream, (String)null); return engine.getFiles(); }
public FTPListParseEngine initiateListParsing(String parserKey, String pathname) throws IOException { if(this.__entryParser == null || !this.__entryParserKey.equals(parserKey)) { if(parserKey != null) { this.__entryParser = this.__parserFactory.createFileEntryParser(parserKey); this.__entryParserKey = parserKey; } else if(this.__configuration != null) { this.__entryParser = this.__parserFactory.createFileEntryParser(this.__configuration); this.__entryParserKey = this.__configuration.getServerSystemKey(); } else { String systemType = System.getProperty("org.apache.commons.net.ftp.systemType"); if(systemType == null) { systemType = this.getSystemType(); Properties override = getOverrideProperties(); if(override != null) { String newType = override.getProperty(systemType); if(newType != null) { systemType = newType; } } } this.__entryParser = this.__parserFactory.createFileEntryParser(systemType); this.__entryParserKey = systemType; } } return this.initiateListParsing(this.__entryParser, pathname); }
public FTPFile[] mlistDir(String pathname) throws IOException { FTPListParseEngine engine = this.initiateMListParsing(pathname); return engine.getFiles(); }
public FTPFile[] mlistDir(String pathname, FTPFileFilter filter) throws IOException { FTPListParseEngine engine = this.initiateMListParsing(pathname); return engine.getFiles(filter); }
public FTPFile[] listFiles(String pathname) throws IOException { FTPListParseEngine engine = this.initiateListParsing((String)null, pathname); return engine.getFiles(); }
public FTPFile[] listFiles(String pathname, FTPFileFilter filter) throws IOException { FTPListParseEngine engine = this.initiateListParsing((String)null, pathname); return engine.getFiles(filter); }
public FTPListParseEngine initiateListParsing() throws IOException { return this.initiateListParsing((String)null); }
public FTPListParseEngine initiateListParsing(String pathname) throws IOException { return this.initiateListParsing((String)null, pathname); }
public FTPListParseEngine initiateListParsing() throws IOException { return delegate.initiateListParsing(); }
public FTPListParseEngine initiateListParsing(String pathname) throws IOException { return delegate.initiateListParsing(pathname); }
public FTPListParseEngine initiateListParsing(String parserKey, String pathname) throws IOException { return delegate.initiateListParsing(parserKey, pathname); }
public FTPListParseEngine initiateListParsing() throws IOException { return this.delegate.initiateListParsing(); }
public FTPListParseEngine initiateListParsing(String pathname) throws IOException { return this.delegate.initiateListParsing(pathname); }
public FTPListParseEngine initiateListParsing(String parserKey, String pathname) throws IOException { return this.delegate.initiateListParsing(parserKey, pathname); }
private static boolean commonsGetFolder(FTPClient client, String rFolder, String lFolder) { //logger.info("Getting folder " + rFolder + "."); // check if client is connected if(!client.isConnected()) { //logger.error("ftp client was not connected"); return false; } try { // create local folder new File(lFolder).mkdir(); // move to current folder client.changeWorkingDirectory(rFolder); // loop through remote folder FTPListParseEngine engine = client.initiateListParsing(); // loop through files while(engine.hasNext()) { FTPFile[] files = engine.getNext(10); for(FTPFile file : files) { if(file.isDirectory()) { String childFolder = lFolder + "/" + file.getName(); commonsGetFolder(client, childFolder, file.getName()); } else { String lFilename = lFolder + "/" + file.getName(); commonsGetFile(client, lFilename, file.getName()); } } } // move back to parent folder client.changeToParentDirectory(); } catch(Exception e) { //logger.error("Could not upload folder",e); return false; } return true; }
public FTPListParseEngine getFTPListParseEngine() { return listEngine; }
FTPListParseEngine initiateListParsing() throws IOException;
FTPListParseEngine initiateListParsing(String pathname) throws IOException;
FTPListParseEngine initiateListParsing(String parserKey, String pathname) throws IOException;