You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rw...@apache.org on 2008/03/10 15:03:56 UTC
svn commit: r635558 - in
/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp:
FTP.java FTPClient.java FTPCommand.java
Author: rwinston
Date: Mon Mar 10 07:03:52 2008
New Revision: 635558
URL: http://svn.apache.org/viewvc?rev=635558&view=rev
Log:
Add support for MDTM command
Modified:
commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java
commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPCommand.java
Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java?rev=635558&r1=635557&r2=635558&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java Mon Mar 10 07:03:52 2008
@@ -1145,6 +1145,12 @@
{
return sendCommand(FTPCommand.REST, marker);
}
+
+
+ public int mdtm(String file) throws IOException
+ {
+ return sendCommand(FTPCommand.MDTM, file);
+ }
/***
* A convenience method to send the FTP RNFR command to the server,
Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=635558&r1=635557&r2=635558&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Mon Mar 10 07:03:52 2008
@@ -1912,7 +1912,7 @@
{
return FTPReply.isPositiveCompletion(noop());
}
-
+
/***
* Obtain a list of filenames in a directory (or just the name of a given
@@ -2356,6 +2356,21 @@
if (FTPReply.isPositiveCompletion(stat(pathname)))
return getReplyString();
return null;
+ }
+
+
+ /**
+ * Issue the FTP MDTM command (not supported by all servers to retrieve the last
+ * modification time of a file. The modification string should be in the form "YYYYMMDDhhmmss"
+ *
+ * @param pathname The file path to query.
+ * @return A string representing the last file modification time in <code>YYYYMMDDhhmmss</code> format.
+ * @throws IOException if an I/O error occurs.
+ */
+ public String getModificationTime(String pathname) throws IOException {
+ if (FTPReply.isPositiveCompletion(mdtm(pathname)))
+ return getReplyString();
+ return null;
}
Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPCommand.java?rev=635558&r1=635557&r2=635558&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPCommand.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPCommand.java Mon Mar 10 07:03:52 2008
@@ -66,6 +66,7 @@
public static final int STAT = 30;
public static final int HELP = 31;
public static final int NOOP = 32;
+ public static final int MDTM = 33;
public static final int USERNAME = USER;
public static final int PASSWORD = PASS;
@@ -100,6 +101,7 @@
public static final int STATUS = STAT;
//public static final int HELP = HELP;
//public static final int NOOP = NOOP;
+ public static final int MOD_TIME = MDTM;
// Cannot be instantiated
private FTPCommand()