java.lang.Object | +--com.shorindo.FtpConnection
簡単なFTPクライアントの実装。典型的には以下のように使用します。
FtpConnection ftp = new FtpConnection(); ftp.login("user", "pass"); ftp.cd("/tmp"); ftp.put("a.txt", "b.txt"); ftp.get("b.txt", "c.txt"); ftp.quit();
Constructor Detail |
public FtpConnection()
Method Detail |
public void open(java.lang.String host) throws java.io.IOException
host
- FTPサーバのホスト名もしくはIPアドレスpublic void login(java.lang.String user, java.lang.String pass) throws java.io.IOException
user
- ユーザIDpass
- パスワードpublic void quit() throws java.io.IOException
public java.lang.String[] ls() throws java.io.IOException
public java.lang.String[] ls(java.lang.String dir) throws java.io.IOException
dir
- ディレクトリ名またはファイル名public void cd(java.lang.String dir) throws java.io.IOException
dir
- 移動先のディレクトリ名public void mkdir(java.lang.String dir) throws java.io.IOException
dir
- 作成するディレクトリ名public void rmdir(java.lang.String dir) throws java.io.IOException
dir
- 削除するディレクトリ名public java.lang.String pwd() throws java.io.IOException
public void get(java.lang.String rfile, java.lang.String lfile) throws java.io.IOException
rfile
- FTPサーバ上のファイル名lfile
- ローカルファイル名public void put(java.lang.String lfile, java.lang.String rfile) throws java.io.IOException
lfile
- ローカルファイル名rfile
- FTPサーバ上のファイル名public void abort() throws java.io.IOException
public void ascii() throws java.io.IOException
public void binary() throws java.io.IOException
public void lcd(java.lang.String dir) throws java.io.IOException
public void delete(java.lang.String file) throws java.io.IOException
file
- FTPサーバ上のファイル名public void rename(java.lang.String oldfile, java.lang.String newfile) throws java.io.IOException
oldfile
- FTPサーバ上の現在のファイル名newfile
- FTPサーバ上の新しいファイル名public void setInterface(int h1, int h2, int h3, int h4)
h1
- IPアドレスの1バイト目h2
- IPアドレスの2バイト目h3
- IPアドレスの3バイト目h4
- IPアドレスの4バイト目public void setTimeout(int timer)
timer
- 待ちうけ時間(ミリ秒)public void debug(int level)
level
- デバッグレベルpublic void finalize() throws java.lang.Throwable