英特內軟體股份有限公司


jcx.net
Class ftp

java.lang.Object
  |
  +--jcx.net.ftp

public class ftp
extends java.lang.Object

此類別 ftp 為一 ftp client API, 凡是欲連結 Ftp Server 皆可引用此 API 。


Constructor Summary
ftp()
           
 
Method Summary
 void ASCII()
          set current mode to ASCII
 void bin()
          set current mode to Binary
 boolean chdir(java.lang.String dir1)
          change directory on ftp server
 java.lang.String close()
          Close ftp session
static java.util.Vector cutToken(java.lang.String data1, java.lang.String deli)
           
 boolean delete(java.lang.String file_name)
           刪除 server端檔案
 java.io.DataInputStream dir(java.lang.String file_name)
           讀取server端檔案資訊
 java.io.DataInputStream get(java.lang.String remote_file)
          Retirve file from ftp server
 java.lang.String getHost()
           
static void main(java.lang.String[] args)
           
 boolean mkdir(java.lang.String path_name)
           建立server端目錄
 boolean open(java.lang.String host)
          open conection to ftp server.
 boolean open(java.lang.String host, java.lang.String id, java.lang.String pwd)
          open conection to ftp server.
 boolean put(byte[] b, java.lang.String remote_file)
          transfer file to server.
 boolean put(java.io.InputStream in, java.lang.String remote_file)
          transfer file to server.
 boolean rename(java.lang.String source_name, java.lang.String dest_name)
           rename server端檔案
 boolean rmdir(java.lang.String path_name)
           刪除server端目錄
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ftp

public ftp()
Method Detail

open

public boolean open(java.lang.String host)
             throws java.io.IOException
open conection to ftp server.
Parameters:
host - Host to be connected.
Throws:
java.io.IOException - if login error

getHost

public java.lang.String getHost()

open

public boolean open(java.lang.String host,
                    java.lang.String id,
                    java.lang.String pwd)
             throws java.io.IOException
open conection to ftp server.
Parameters:
host - Host to be connected.
id - ftp login ID (override constructor ID).
pwd - ftp login PASSWORD (override constructor PWD).
Throws:
java.io.IOException - if login error

bin

public void bin()
set current mode to Binary

ASCII

public void ASCII()
set current mode to ASCII

put

public boolean put(byte[] b,
                   java.lang.String remote_file)
transfer file to server.
Parameters:
b - data of file content.
remote_file - remote filename to store on ftp server.
Returns:
boolean true if success,false else.

put

public boolean put(java.io.InputStream in,
                   java.lang.String remote_file)
transfer file to server.
Parameters:
in - InputStream of data to be transfer.
remote_file - remote filename to store on ftp server.
Returns:
boolean true if success,false else.

chdir

public boolean chdir(java.lang.String dir1)
              throws java.io.IOException
change directory on ftp server
Parameters:
dir1 - Director to be changed.
remote_file - remote filename to store on ftp server.
Returns:
boolean true if success,false else.
Throws:
java.io.IOException - if chdir error

close

public java.lang.String close()
Close ftp session
Returns:
String ftp command history.

get

public java.io.DataInputStream get(java.lang.String remote_file)
Retirve file from ftp server
Parameters:
remote_file - remote filename on ftp server.
Returns:
DataInputStream DataInputStream of the remote file,if remote file doesn't exists, return null;

rename

public boolean rename(java.lang.String source_name,
                      java.lang.String dest_name)
               throws java.io.IOException
rename server端檔案
Returns:
boolean rename成功 true rename失敗 false

delete

public boolean delete(java.lang.String file_name)
               throws java.io.IOException
刪除 server端檔案
Returns:
boolean 建立成功 true 建立失敗 false

mkdir

public boolean mkdir(java.lang.String path_name)
              throws java.io.IOException
建立server端目錄
Returns:
boolean 建立成功 true 建立失敗 false

rmdir

public boolean rmdir(java.lang.String path_name)
              throws java.io.IOException
刪除server端目錄
Returns:
boolean 刪除成功 true 刪除失敗 false

dir

public java.io.DataInputStream dir(java.lang.String file_name)
                            throws java.io.IOException
讀取server端檔案資訊
Returns:
DataInputStream 無檔案資料 return null

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException

cutToken

public static java.util.Vector cutToken(java.lang.String data1,
                                        java.lang.String deli)

英特內軟體股份有限公司