You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2004/01/03 18:55:22 UTC
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPFileEntryParser.java
scohen 2004/01/03 09:55:22
Modified: net/src/java/org/apache/commons/net/ftp
FTPFileEntryParser.java
Log:
Added more documentation for the new APIs added to FTPClient, in relation
to parsers.
Revision Changes Path
1.8 +46 -4 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPFileEntryParser.java
Index: FTPFileEntryParser.java
===================================================================
RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPFileEntryParser.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FTPFileEntryParser.java 2 Jan 2004 03:39:04 -0000 1.7
+++ FTPFileEntryParser.java 3 Jan 2004 17:55:22 -0000 1.8
@@ -65,9 +65,14 @@
* case you would create your own implementation of FTPFileEntryParser and
* if necessary, subclass FTPFile.
* <p>
- * Here is an example showing how to use one of the classes that
- * implement this interface. In the following example <code>parser </code>
- * is an object (in the package <code>org.apache.commons.net.ftp.parser</code>)
+ * Here are some examples showing how to use one of the classes that
+ * implement this interface.
+ * <p>
+ * The first example shows how to get an <b>iterable</b> list of files in which the
+ * more expensive <code>FTPFile</code> objects are not created until needed. This
+ * is suitable for paged displays. It requires that a parser object be created
+ * beforehand: <code>parser</code> is an object (in the package
+ * <code>org.apache.commons.net.ftp.parser</code>)
* implementing this inteface.
*
* <pre>
@@ -84,6 +89,43 @@
* }
* </pre>
*
+ * The second example uses the newer <code>FTPClient.getFileList()</code>
+ * API to pull the whole list from the <code>subfolder</code>in one call,
+ * attempting to automatically detect the parser type. The null parameter
+ * indicates that autodection should be used.
+ *
+ * <pre>
+ * FTPClient f=FTPClient();
+ * f.connect(server);
+ * f.login(username, password);
+ * FTPFile[] files = f.getFileList(null, "subfolder");
+ * </pre>
+ *
+ * The third example uses the newer <code>FTPClient.getFileList()</code>
+ * API to pull the whole list from the current working directory in one call,
+ * but specifying by classname the parser to be used. For this particular
+ * parser class, this approach is necessary since there is no way to
+ * autodetect this server type.
+ *
+ * <pre>
+ * FTPClient f=FTPClient();
+ * f.connect(server);
+ * f.login(username, password);
+ * FTPFile[] files = f.getFileList(
+ * "org.apache.commons.net.ftp.parser.EnterpriseUnixFTPFileEntryParser");
+ * </pre>
+ *
+ * The fourth example uses the newer <code>FTPClient.getFileList()</code>
+ * API to pull a single file listing in an arbitrary directory in one call,
+ * specifying by KEY the parser to be used, in this case, VMS.
+ *
+ * <pre>
+ * FTPClient f=FTPClient();
+ * f.connect(server);
+ * f.login(username, password);
+ * FTPFile[] files = f.getFileList("VMS", "subfolder/foo.java");
+ * </pre>
+ *
* @author <a href="mailto:scohen@apache.org">Steve Cohen</a>
* @version $Id$
* @see org.apache.commons.net.ftp.FTPFile
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org