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 2005/01/02 16:50:15 UTC

cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPClient.java FTPClientConfig.java

scohen      2005/01/02 07:50:15

  Modified:    net/src/java/org/apache/commons/net/ftp FTPClient.java
                        FTPClientConfig.java
  Log:
  Update documentation to reflect new FTPClientConfig functionality.
  
  Revision  Changes    Path
  1.49      +15 -11    jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java
  
  Index: FTPClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- FTPClient.java	2 Jan 2005 03:28:13 -0000	1.48
  +++ FTPClient.java	2 Jan 2005 15:50:15 -0000	1.49
  @@ -105,10 +105,9 @@
    * for EBCDIC.  To transfer EBCDIC and other unsupported file types you
    * must create your own filter InputStreams and OutputStreams and wrap
    * them around the streams returned or required by the FTPClient methods.
  - * FTPClient uses the NetASCII filter streams in
  - * {@link org.apache.commons.net.io} to provide
  - * transparent handling of ASCII files.  We will consider incorporating
  - * EBCDIC support if there is enough demand.
  + * FTPClient uses the {@link ToNetASCIIOutputStream NetASCII}  
  + * filter streams to provide transparent handling of ASCII files.  We will 
  + * consider incorporating EBCDIC support if there is enough demand.
    * <p>
    * <code> FTP.NON_PRINT_TEXT_FORMAT </code>,
    * <code> FTP.STREAM_TRANSFER_MODE </code>, and
  @@ -209,23 +208,28 @@
    *    }
    * </pre>
    * <p>
  + * For examples of using FTPClient on servers whose directory listings 
  + * <ul> 
  + * <li>use languages other than English</li>
  + * <li>use date formats other than the American English "standard" <code>MM d yyyy</code></li>
  + * <li>are in different timezones and you need accurate timestamps for dependency checking 
  + *     as in Ant</li>
  + * </ul>see {@link  FTPClientConfig  FTPClientConfig}.
  + * <p>
    * NOTE: If you experience problems with unwanted firing of <pre>setSoTimeout()</pre> 
    * during periods of client inactivity, this can be alleviated by calling <pre>setReaderThread(false)</pre>.
    * For more details, see <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=31122">this thread</a>. 
    * </p>
  - * <p> * @author Daniel F. Savarese
  + * <p> 
  + * @author Daniel F. Savarese
    * @see FTP
    * @see FTPConnectionClosedException
    * @see FTPFileEntryParser
    * @see FTPFileEntryParserFactory
    * @see DefaultFTPFileEntryParserFactory
  + * @see FTPClientConfig
    * @see org.apache.commons.net.MalformedServerReplyException
  - ***/
  -
  -/**
  - * To change the template for this generated type comment go to
  - * Window - Preferences - Java - Code Style - Code Templates - Comments
  - */
  + **/
   public class FTPClient extends FTP
   implements Configurable
   {
  
  
  
  1.2       +84 -0     jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClientConfig.java
  
  Index: FTPClientConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClientConfig.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FTPClientConfig.java	2 Jan 2005 03:17:49 -0000	1.1
  +++ FTPClientConfig.java	2 Jan 2005 15:50:15 -0000	1.2
  @@ -42,6 +42,90 @@
    * only need to be explicitly invoked by the user of this package for problem
    * cases that previous implementations could not solve.
    * </p>
  + * <h3>Examples of use of FTPClientConfig</h3>
  + * Use cases:
  + * You are trying to access a server that 
  + * <ul> 
  + * <li>lists files with timestamps that use month names in languages other 
  + * than English</li>
  + * <li>lists files with timestamps that use date formats other 
  + * than the American English "standard" <code>MM dd yyyy</code></li>
  + * <li>is in different timezone and you need accurate timestamps for 
  + * dependency checking as in Ant</li>
  + * </ul>
  + * <p>
  + * Unpaged (whole list) access on a UNIX server that uses French month names
  + * but uses the "standard" <code>MMM d yyyy</code> date formatting
  + * <pre>
  + *    FTPClient f=FTPClient();
  + *    FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
  + * 	  conf.setServerLanguageCode("fr");
  + *    f.connect(server);
  + *    f.login(username, password);
  + *    FTPFile[] files = listFiles(directory);
  + * </pre>
  + * </p>
  + * <p>
  + * Paged access on a UNIX server that uses Danish month names
  + * and "European" date formatting in Denmark's time zone, when you
  + * are in some other time zone.
  + * <pre>
  + *    FTPClient f=FTPClient();
  + *    FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
  + * 	  conf.setServerLanguageCode("da");
  + * 	  conf.setDefaultDateFormat("d MMM yyyy");
  + *    conf.setRecentDateFormat("d MMM HH:mm"); 
  + * 	  conf.setTimeZoneId("Europe/Copenhagen");
  + *    f.connect(server);
  + *    f.login(username, password);
  + *    FTPListParseEngine engine =
  + *       f.initiateListParsing("com.whatever.YourOwnParser", 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.
  + *    }
  + * </pre>
  + * </p> 
  + * <p>
  + * Unpaged (whole list) access on a VMS server that uses month names
  + * in a language not {@link #getSupportedLanguageCodes() supported} by the system.
  + * but uses the "standard" <code>MMM d yyyy</code> date formatting
  + * <pre>
  + *    FTPClient f=FTPClient();
  + *    FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_VMS);
  + * 	  conf.setShortMonthNames(
  + * 		"jan|feb|mar|apr|ma&#xED;|j&#xFA;n|j&#xFA;l|&#xE1;g&#xFA;|sep|okt|n&#xF3;v|des");
  + *    f.connect(server);
  + *    f.login(username, password);
  + *    FTPFile[] files = listFiles(directory);
  + * </pre>
  + * </p>
  + * <p>
  + * Unpaged (whole list) access on a Windows-NT server in a different time zone.
  + * (Note, since the NT Format uses numeric date formatting, language issues
  + * are irrelevant here).
  + * <pre>
  + *    FTPClient f=FTPClient();
  + *    FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_NT);
  + * 	  conf.setTimeZoneId("America/Denver");
  + *    f.connect(server);
  + *    f.login(username, password);
  + *    FTPFile[] files = listFiles(directory);
  + * </pre>
  + * </p>
  + * Unpaged (whole list) access on a Windows-NT server in a different time zone
  + * but which has been configured to use a unix-style listing format.
  + * <pre>
  + *    FTPClient f=FTPClient();
  + *    FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
  + * 	  conf.setTimeZoneId("America/Denver");
  + *    f.connect(server);
  + *    f.login(username, password);
  + *    FTPFile[] files = listFiles(directory);
  + * </pre>
  + * </p>
    * @since 1.4
    * @see org.apache.commons.net.ftp.Configurable
    * @see org.apache.commons.net.ftp.FTPClient
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org