List of usage examples for org.apache.commons.net.ftp FTPListParseEngine FTPListParseEngine
public FTPListParseEngine(FTPFileEntryParser parser)
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * private method through which all listFiles() and * initiateListParsing methods pass once a parser is determined. * * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException/*w ww . ja va 2 s. c om*/ * If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. * @see FTPListParseEngine */ private FTPListParseEngine initiateListParsing(FTPFileEntryParser parser, String pathname) throws IOException { Socket socket = _openDataConnection_(FTPCmd.LIST, getListArguments(pathname)); FTPListParseEngine engine = new FTPListParseEngine(parser); if (socket == null) { return engine; } try { engine.readServerList(socket.getInputStream(), getControlEncoding()); } finally { Util.closeQuietly(socket); } completePendingCommand(); return engine; }
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * Initiate list parsing for MLSD listings. * * @param pathname/*from w w w . j a v a 2s . c om*/ * @return the engine * @throws IOException */ private FTPListParseEngine initiateMListParsing(String pathname) throws IOException { Socket socket = _openDataConnection_(FTPCmd.MLSD, pathname); FTPListParseEngine engine = new FTPListParseEngine(MLSxEntryParser.getInstance()); if (socket == null) { return engine; } try { engine.readServerList(socket.getInputStream(), getControlEncoding()); } finally { Util.closeQuietly(socket); completePendingCommand(); } return engine; }