Author: sebb
Date: Mon Feb 24 13:16:21 2014
New Revision: 1571274
URL: http://svn.apache.org/r1571274
Log:
Add control encoding option
Modified:
commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java
Modified:
commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java?rev=1571274&r1=1571273&r2=1571274&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java
(original)
+++ commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java
Mon Feb 24 13:16:21 2014
@@ -59,6 +59,7 @@ public final class FTPClientExample
"\t-c cmd - issue arbitrary command (remote is used as a parameter if
provided) \n" +
"\t-d - list directory details using MLSD (remote is used as the
pathname if provided)\n" +
"\t-e - use EPSV with IPv4 (default false)\n" +
+ "\t-E - encoding to use for control channel\n" +
"\t-f - issue FEAT command (remote and local files are ignored)\n" +
"\t-h - list hidden files (applies to -l and -n only)\n" +
"\t-k secs - use keep-alive timer (setControlKeepAliveTimeout)\n" +
@@ -94,6 +95,7 @@ public final class FTPClientExample
String proxyPassword = null;
String username = null;
String password = null;
+ String encoding = null;
int base = 0;
for (base = 0; base < args.length; base++)
@@ -122,6 +124,9 @@ public final class FTPClientExample
else if (args[base].equals("-e")) {
useEpsvWithIPv4 = true;
}
+ else if (args[base].equals("-E")) {
+ encoding = args[++base];
+ }
else if (args[base].equals("-f")) {
feat = true;
minParams = 3;
@@ -252,6 +257,9 @@ public final class FTPClientExample
if (controlKeepAliveReplyTimeout >= 0) {
ftp.setControlKeepAliveReplyTimeout(controlKeepAliveReplyTimeout);
}
+ if (encoding != null) {
+ ftp.setControlEncoding(encoding);
+ }
ftp.setListHiddenFiles(hidden);
// suppress login details