?? ftpstreamtest.java
字號:
import cz.dhl.io.*;
import cz.dhl.ftp.*;
import java.io.*;
public class FtpStreamTest
{
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();
FtpInputStream is = null;
try
{ String line;
/* connect & login to host */
cl.connect(cn);
/* source FtpFile remote file */
FtpFile file = new FtpFile("/Welcome",cl);
System.out.println("From: " +file.toString());
/* open ftp input stream */
is = new FtpInputStream(file);
BufferedReader br = new BufferedReader
(new InputStreamReader(is));
/* read ftp input stream */
while ((line = br.readLine()) != null)
System.out.println(line);
/* close reader */
br.close();
}
catch (IOException e)
{ System.out.println(e); }
finally
{ /* close ftp input stream
* this must be always run */
if(is!=null)
try { is.close(); }
catch (IOException e) {}
/* disconnect from server
* this must be always run */
cl.disconnect(); }
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -