java 连接ftp 测试_JAVA连接FTP测试程序

package examples.ftp;

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.InputStream;

import java.io.OutputStream;

import java.io.PrintWriter;

import java.net.InetAddress;

import java.net.UnknownHostException;

import org.apache.commons.net.PrintCommandListener;

import org.apache.commons.net.ftp.FTP;

import org.apache.commons.net.ftp.FTPClient;

import org.apache.commons.net.ftp.FTPHTTPClient;

import org.apache.commons.net.ftp.FTPClientConfig;

import

org.apache.commons.net.ftp.FTPConnectionClosedException;

import org.apache.commons.net.ftp.FTPFile;

import org.apache.commons.net.ftp.FTPReply;

import org.apache.commons.net.ftp.FTPSClient;

import org.apache.commons.net.io.CopyStreamEvent;

import org.apache.commons.net.io.CopyStreamListener;

import org.apache.commons.net.util.TrustManagerUtils;

public final class FTPClientExample

{

public static final

String USAGE =

"Usage: ftp [options] [ []]\n" +

"\nDefault behavior is to download a file and

use ASCII transfer mode.\n" +

"\t-a - use local active mode (default is local

passive)\n" +

"\t-A - anonymous login (omit username and

password parameters)\n" +

"\t-b - use binary transfer mode\n" +

"\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-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" +

"\t-l - list files using LIST (remote is used as

the pathname if provided)\n" +

"\t  Files

are listed twice: first in raw mode, then as the formatted parsed

data.\n" +

"\t-L - use lenient future dates (server dates

may be up to 1 day into future)\n" +

"\t-n - list file names using NLST (remote is

used as the pathname if provided)\n" +

"\t-p true|false|protocol[,true|false] - use

FTPSClient with the specified protocol and/or isImplicit setting\n"

+

"\t-s - store file on server (upload)\n" +

"\t-t - list file details using MLST (remote is

used as the pathname if provided)\n" +

"\t-w msec - wait time for keep-alive reply

(setControlKeepAliveReplyTimeout)\n" +

"\t-T  all|valid|none - use one

of the built-in TrustManager implementations (none = JVM

default)\n" +

"\t-PrH server[:port] - HTTP Proxy host and

optional port[80] \n" +

"\t-PrU user - HTTP Proxy server username\n"

+

"\t-PrP password - HTTP Proxy server password\n"

+

"\t-# - add hash display during

transfers\n";

public static void

main(String[] args) throws UnknownHostException

<
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值