パッケージ jp.co.sds_corp.ftp
クラス FtpClient
- java.lang.Object
-
- jp.co.sds_corp.ftp.FtpClient
-
public class FtpClient extends Object
-
-
ネストされたクラスの概要
ネストされたクラス 修飾子とタイプ クラス 説明 static class
FtpClient.TransferMode
-
メソッドの概要
すべてのメソッド インスタンス・メソッド concreteメソッド 修飾子とタイプ メソッド 説明 void
abort()
処理を中断しますvoid
account(String acct)
課金情報を送信しますvoid
append(String file)
ファイルを送信しますvoid
append(String remoteFile, InputStream in)
ファイルを送信しますvoid
append(String remoteFile, String localFile)
ファイルを送信しますvoid
cd(String dir)
ディレクトリを変更しますvoid
cdup()
一つ上のディレクトリに移動しますvoid
close()
接続をクローズしますvoid
connect()
FTP Serverに接続します。void
connect(String host, int nPort)
指定されたポートでFTP Serverに接続します。void
delete(String file)
ファイルを削除しますvoid
disconnect()
FTP Serverとの接続を解除します。void
get(String file)
ファイルを受信しますvoid
get(String remoteFile, OutputStream out)
ファイルを受信しますvoid
get(String remoteFile, String localFile)
ファイルを受信しますprotected Socket
getDataSocket()
データ接続を取得しますprotected String
getDirectoryName()
レスポンス文字列からディレクトリ名を切り出すString
getHost()
ホスト(host)を取得します。String
getMessage()
送信したコマンドに対するレスポンスを返します。String
getPassword()
パスワード(password)を取得します。int
getPort()
ポート番号(port)を取得します。String
getResponse()
送信したコマンドに対する応答メッセージを返します。int
getResponseCode()
送信したコマンドに対する最終のレスポンスコードを返します。int
getTimeout()
タイムアウト時間(ミリ秒)(timeout)を取得します。String
getUser()
ユーザ名(user)を取得します。String
help()
ヘルプを取得しますList<FtpFile>
list()
ファイル一覧を取得しますvoid
login(String user, String password)
FTP Serverにログインしますvoid
mkdir(String dir)
ディレクトリを作成しますvoid
noop()
何もしませんint
parseResponseCode(String response)
応答メッセージからレスポンスコードを解析しますvoid
passive()
Passiveモードを設定しますvoid
port()
データポートを指定しますprotected void
prepareDataSocket()
データ接続の準備を行いますvoid
put(String file)
ファイルを送信しますvoid
put(String remoteFile, InputStream in, boolean bUniq)
ファイルを送信しますvoid
put(String remoteFile, String localFile)
ファイルを送信しますvoid
put(String remoteFile, String localFile, boolean bUniq)
ファイルを送信しますString
pwd()
現在のディレクトリを取得しますprotected void
readDataStream(OutputStream out)
データ接続からデータを読み込みますprotected void
readResponse()
応答を読み込みますprotected boolean
ready()
応答を取得できる状態であるかを確認しますvoid
rename(String from, String to)
ファイル名を変更しますvoid
rmdir(String dir)
ディレクトリを削除しますprotected void
sendCommand(String cmd)
コマンドを送信し、応答を取得しますvoid
setDebug(boolean debug)
デバッグモードの設定をしますvoid
setHost(String var)
ホスト(host)を設定します。void
setPassive(boolean pasv)
Passiveモードの設定をしますvoid
setPassword(String var)
パスワード(password)を設定します。void
setPort(int var)
ポート番号(port)を設定します。void
setTimeout(int var)
タイムアウト時間(ミリ秒)(timeout)を設定します。void
setUser(String var)
ユーザ名(user)を設定します。String
site()
SITEパラメータを取得しますString
stat()
ステータスを取得しますString
system()
システム名称を取得しますvoid
type(FtpClient.TransferMode mode)
ファイルタイプを設定しますprotected void
writeCommand(String cmd)
コマンドを送信しますprotected void
writeDataStream(InputStream in)
データ接続にデータを書き込みます
-
-
-
コンストラクタの詳細
-
FtpClient
public FtpClient()
コンストラクタ
-
FtpClient
public FtpClient(String host) throws IOException, FtpServerException
コンストラクタ- パラメータ:
host
- 接続先ホスト名- 例外:
IOException
FtpServerException
-
FtpClient
public FtpClient(String host, String user, String password) throws IOException, FtpServerException
コンストラクタ- パラメータ:
host
- 接続先ホスト名user
- ユーザ名password
- パスワード- 例外:
IOException
FtpServerException
-
-
メソッドの詳細
-
setHost
public void setHost(String var)
ホスト(host)を設定します。- パラメータ:
var
- 設定するデータ
-
getHost
public String getHost()
ホスト(host)を取得します。- 戻り値:
- hostの内容
-
setPort
public void setPort(int var)
ポート番号(port)を設定します。- パラメータ:
var
- 設定するデータ
-
getPort
public int getPort()
ポート番号(port)を取得します。- 戻り値:
- portの内容
-
setUser
public void setUser(String var)
ユーザ名(user)を設定します。- パラメータ:
var
- 設定するデータ
-
getUser
public String getUser()
ユーザ名(user)を取得します。- 戻り値:
- userの内容
-
setPassword
public void setPassword(String var)
パスワード(password)を設定します。- パラメータ:
var
- 設定するデータ
-
getPassword
public String getPassword()
パスワード(password)を取得します。- 戻り値:
- passwordの内容
-
setDebug
public void setDebug(boolean debug)
デバッグモードの設定をします- パラメータ:
debug
- true:デバッグモード false:通常モード
-
setPassive
public void setPassive(boolean pasv)
Passiveモードの設定をします- パラメータ:
pasv
- true:Passiveモード false:通常モード
-
getResponse
public String getResponse()
送信したコマンドに対する応答メッセージを返します。- 戻り値:
- 応答メッセージ
-
setTimeout
public void setTimeout(int var)
タイムアウト時間(ミリ秒)(timeout)を設定します。- パラメータ:
var
- 設定するデータ
-
getTimeout
public int getTimeout()
タイムアウト時間(ミリ秒)(timeout)を取得します。- 戻り値:
- timeoutの内容
-
getResponseCode
public int getResponseCode()
送信したコマンドに対する最終のレスポンスコードを返します。- 戻り値:
- レスポンスコード
-
parseResponseCode
public int parseResponseCode(String response)
応答メッセージからレスポンスコードを解析します- 戻り値:
- レスポンスコード
-
getMessage
public String getMessage()
送信したコマンドに対するレスポンスを返します。- 戻り値:
- レスポンス
-
getDirectoryName
protected String getDirectoryName()
レスポンス文字列からディレクトリ名を切り出す
-
sendCommand
protected void sendCommand(String cmd) throws IOException
コマンドを送信し、応答を取得します- 例外:
IOException
-
writeCommand
protected void writeCommand(String cmd) throws IOException
コマンドを送信します- 例外:
IOException
-
ready
protected boolean ready() throws IOException
応答を取得できる状態であるかを確認します- 戻り値:
- true:読み込み可 false:読み込み不可
- 例外:
IOException
-
readResponse
protected void readResponse() throws IOException
応答を読み込みます- 例外:
IOException
-
prepareDataSocket
protected void prepareDataSocket() throws IOException, FtpServerException
データ接続の準備を行います
-
getDataSocket
protected Socket getDataSocket() throws IOException, FtpServerException
データ接続を取得します
-
readDataStream
protected void readDataStream(OutputStream out) throws IOException, FtpServerException
データ接続からデータを読み込みます
-
writeDataStream
protected void writeDataStream(InputStream in) throws IOException, FtpServerException
データ接続にデータを書き込みます
-
connect
public void connect() throws IOException, UnknownHostException, FtpServerException
FTP Serverに接続します。
-
connect
public void connect(String host, int nPort) throws IOException, UnknownHostException, FtpServerException
指定されたポートでFTP Serverに接続します。- パラメータ:
host
- 接続先ホスト名nPort
- 接続先ポート番号- 例外:
IOException
UnknownHostException
FtpServerException
-
disconnect
public void disconnect() throws IOException, UnknownHostException, FtpServerException
FTP Serverとの接続を解除します。
-
login
public void login(String user, String password) throws IOException, FtpServerException
FTP Serverにログインします- パラメータ:
user
- ユーザ名password
- パスワード- 例外:
IOException
FtpServerException
-
account
public void account(String acct) throws IOException, FtpServerException
課金情報を送信します- パラメータ:
acct
- 課金情報- 例外:
IOException
FtpServerException
-
port
public void port() throws IOException, FtpServerException
データポートを指定します
-
passive
public void passive() throws IOException, FtpServerException
Passiveモードを設定します
-
list
public List<FtpFile> list() throws IOException, FtpServerException
ファイル一覧を取得します- 戻り値:
- ファイル一覧
- 例外:
IOException
FtpServerException
-
get
public void get(String file) throws IOException, FtpServerException
ファイルを受信します
-
get
public void get(String remoteFile, String localFile) throws IOException, FtpServerException
ファイルを受信します
-
get
public void get(String remoteFile, OutputStream out) throws IOException, FtpServerException
ファイルを受信します
-
put
public void put(String file) throws IOException, FtpServerException
ファイルを送信します
-
put
public void put(String remoteFile, String localFile) throws IOException, FtpServerException
ファイルを送信します
-
put
public void put(String remoteFile, String localFile, boolean bUniq) throws IOException, FtpServerException
ファイルを送信します
-
put
public void put(String remoteFile, InputStream in, boolean bUniq) throws IOException, FtpServerException
ファイルを送信します
-
append
public void append(String file) throws IOException, FtpServerException
ファイルを送信します
-
append
public void append(String remoteFile, String localFile) throws IOException, FtpServerException
ファイルを送信します
-
append
public void append(String remoteFile, InputStream in) throws IOException, FtpServerException
ファイルを送信します
-
rename
public void rename(String from, String to) throws IOException, FtpServerException
ファイル名を変更します
-
abort
public void abort() throws IOException, FtpServerException
処理を中断します
-
delete
public void delete(String file) throws IOException, FtpServerException
ファイルを削除します
-
mkdir
public void mkdir(String dir) throws IOException, FtpServerException
ディレクトリを作成します
-
rmdir
public void rmdir(String dir) throws IOException, FtpServerException
ディレクトリを削除します
-
site
public String site() throws IOException, FtpServerException
SITEパラメータを取得します
-
noop
public void noop() throws IOException, FtpServerException
何もしません
-
system
public String system() throws IOException, FtpServerException
システム名称を取得します
-
stat
public String stat() throws IOException, FtpServerException
ステータスを取得します
-
type
public void type(FtpClient.TransferMode mode) throws IOException, FtpServerException
ファイルタイプを設定します
-
cd
public void cd(String dir) throws IOException, FtpServerException
ディレクトリを変更します
-
cdup
public void cdup() throws IOException, FtpServerException
一つ上のディレクトリに移動します
-
pwd
public String pwd() throws IOException, FtpServerException
現在のディレクトリを取得します
-
help
public String help() throws IOException, FtpServerException
ヘルプを取得します
-
close
public void close() throws IOException, FtpServerException
接続をクローズします
-
-