commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1074562 - in /commons/proper/net/trunk/src: changes/changes.xml main/java/org/apache/commons/net/ftp/FTPClient.java
Date Fri, 25 Feb 2011 15:02:48 GMT
Author: sebb
Date: Fri Feb 25 15:02:48 2011
New Revision: 1074562

URL: http://svn.apache.org/viewvc?rev=1074562&view=rev
Log:
NET-156 New FTPClient method to retrieve all directory names in the current working directory.

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java

Modified: commons/proper/net/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1074562&r1=1074561&r2=1074562&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml (original)
+++ commons/proper/net/trunk/src/changes/changes.xml Fri Feb 25 15:02:48 2011
@@ -52,6 +52,10 @@ The <action> type attribute can be add,u
 
     <body>
         <release version="2.3" date="TBA" description="TBA">
+            <action issue="NET-156" dev="sebb" type="add">
+            New FTPClient method to retrieve all directory names in the current working directory.
+            Added methods listDirectories(), listDirectories(String path).
+            </action>
             <action issue="NET-353" dev="sebb" type="add" due-to="Bogdan Drozdowski" due-to-email="bogdandr
# op . pl">
             The SMTPClient does not support authentication.
             </action>

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=1074562&r1=1074561&r2=1074562&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java Fri Feb
25 15:02:48 2011
@@ -2344,6 +2344,86 @@ implements Configurable
     }
 
     /**
+     * Using the default system autodetect mechanism, obtain a
+     * list of directories contained in the current working directory.
+     * <p>
+     * This information is obtained through the LIST command.  The contents of
+     * the returned array is determined by the<code> FTPFileEntryParser </code>
+     * used.
+     * <p>
+     * @return The list of directories contained in the current directory
+     *         in the format determined by the autodetection mechanism.
+     *         
+     * @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
+     *                   If an I/O error occurs while either sending a
+     *                   command to the server or receiving a reply
+     *                   from the server.
+     * @exception ParserInitializationException
+     *                   Thrown if the parserKey parameter cannot be
+     *                   resolved by the selected parser factory.
+     *                   In the DefaultFTPEntryParserFactory, this will
+     *                   happen when parserKey is neither
+     *                   the fully qualified class name of a class
+     *                   implementing the interface
+     *                   org.apache.commons.net.ftp.FTPFileEntryParser
+     *                   nor a string containing one of the recognized keys
+     *                   mapping to such a parser or if class loader
+     *                   security issues prevent its being loaded.
+     * @see org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory
+     * @see org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory
+     * @see org.apache.commons.net.ftp.FTPFileEntryParser
+     */
+    public FTPFile[] listDirectories() throws IOException {
+        return listDirectories((String) null);
+    }
+
+    /**
+     * Using the default system autodetect mechanism, obtain a
+     * list of directories contained in the specified directory.
+     * <p>
+     * This information is obtained through the LIST command.  The contents of
+     * the returned array is determined by the<code> FTPFileEntryParser </code>
+     * used.
+     * <p>
+     * @return The list of directories contained in the specified directory
+     *         in the format determined by the autodetection mechanism.
+     *         
+     * @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
+     *                   If an I/O error occurs while either sending a
+     *                   command to the server or receiving a reply
+     *                   from the server.
+     * @exception ParserInitializationException
+     *                   Thrown if the parserKey parameter cannot be
+     *                   resolved by the selected parser factory.
+     *                   In the DefaultFTPEntryParserFactory, this will
+     *                   happen when parserKey is neither
+     *                   the fully qualified class name of a class
+     *                   implementing the interface
+     *                   org.apache.commons.net.ftp.FTPFileEntryParser
+     *                   nor a string containing one of the recognized keys
+     *                   mapping to such a parser or if class loader
+     *                   security issues prevent its being loaded.
+     * @see org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory
+     * @see org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory
+     * @see org.apache.commons.net.ftp.FTPFileEntryParser
+     */
+    public FTPFile[] listDirectories(String parent) throws IOException {
+        return listFiles(parent, FTPFileFilters.DIRECTORIES);
+    }
+
+    /**
      * Using the default autodetect mechanism, initialize an FTPListParseEngine
      * object containing a raw file information for the current working
      * directory on the server



Mime
View raw message