Java implementation ftp upload download functionJava FTP client Toolkit for many, here I choose Apache's ftpclient. The acquisition of this package can be obtained by [Url]http://commons.apache.org/net/[/url], and I am using the latest commons-net-1.4.1.zip. It contains a number of Java Network Programming Toolkit, the official documentation listed below:
The Support network protocol is as follows:
Ftp
NNTP
Smtp
POP3
Telnet
Tftp
Finger
Whois
Rexec/rcmd/rlogin
Time (rdate) and daytime
Echo
Discard
Ntp/sntp
are very useful. Here I use some of the FTP-related packages. Before you write your program, configure a simple FTP server, as shown in the following figure:
Here is a use of ftpclient to achieve the FTP upload and download functions, mainly for this package has a perceptual understanding. The routine is as follows: Import org.apache.commons.io.IOUtils;
Import org.apache.commons.net.ftp.FTPClient;
/**
* Apache Commons-net Try one to see what the FTP client tools do
*
* @author: leizhimin,2008-8-20 14:00:38. <p>
*/
public class Ftptest {
public static void Main (string[] args) {
Testupload ();
Testdownload ();
}
/**
* FTP upload a single file test
*/
public static void Testupload () {
FtpClient ftpclient = new FtpClient ();
FileInputStream FIS = null;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.