Description
The first example on the org.apache.commons.net.ftp.FTPFileEntryParser javadoc page refers to classes that have been removed since version 2.0:
FTPClient f=FTPClient();
f.connect(server);
f.login(username, password);
FTPFileList list = f.createFileList(directory, parser);
FTPFileIterator iter = list.iterator();
while (iter.hasNext())
{ FTPFile[] files = iter.getNext(25); // "page size" you want //do whatever you want with these files, display them, etc. //expensive FTPFile objects not created until needed. }FTPFileList and FTPFileIterator no longer exist.
There is a good replacement for this example on the org.apache.commons.net.ftp.FTPListParseEngine javadoc page and that example should simply replace the one on the FTPFileEntryParser page.
FTPClient f=FTPClient();
f.connect(server);
f.login(username, password);
FTPListParseEngine engine = f.initiateListParsing(directory);
while (engine.hasNext())
{ FTPFile[] files = engine.getNext(25); // "page size" you want //do whatever you want with these files, display them, etc. //expensive FTPFile objects not created until needed. }Attachments
Issue Links
- duplicates
-
NET-303 FTP: FTPFileEntryParser API samples are wrong
- Closed