⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftploadtest.java

📁 jftp-src-test.zip jftp-src-test.zip
💻 JAVA
字号:

import cz.dhl.io.*;
import cz.dhl.ftp.*;
import java.io.IOException;

public class FtpLoadTest
{
   public static void main(String args[]) 
   {
      /* host = ftp.netscape.com;    path = pub;
       * user = anonymous (default); port = 21 (default); */
      FtpConnect cn = FtpConnect.newConnect
         ("ftp://ftp.netscape.com/");
      /* Guest login ok, send your e-mail as password */
      cn.setPassWord("eternity@matrix.com");
      Ftp cl = new Ftp();

      try 
      {  /* connect & login to host */
	 cl.connect(cn);

	 /* source FtpFile remote file */
	 CoFile file = new FtpFile("/Welcome",cl);
	 System.out.println("From: " +file.toString());

	 /* destination LocalFile home dir */
         CoFile to = new LocalFile(System.getProperty("user.dir"),"Welcome");
	 System.out.println("To:   " +to.toString());

	 /* download /Welcome file to home dir*/
	 System.out.println("Load: " +CoLoad.copy(to,file));
      } 
      catch (IOException e) 
	 { System.out.println(e); }
      finally 
      {  /* disconnect from server 
	  * this must be always run */
	 cl.disconnect(); }
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -