ftp中ftpClient類的API


org.apache.commons.NET.ftp 
Class FTPClient類FTPClient 

java.lang.Object java.lang.Object繼承

   org.apache.commons.net.SocketClient org.apache.commons.net.SocketClient

       org.apache.commons.net.ftp.FTP org.apache.commons.net.ftp.FTP

           org.apache.commons.net.ftp.FTPClient org.apache.commons.Net.ftp.FTPClient

All Implemented Interfaces: 所有已實現的接口: 

Configurable 可配置 

Direct Known Subclasses: 直接已知子類: 

FTPHTTPClient , FTPSClient FTPHTTPClient , FTPSClient 

 public class FTPClient公共類FTPClient 

 extends FTP延伸的FTP 

 implements Configurable實現了可配置 

FTPClient encapsulates all the functionality necessary to store and retrieve files from an FTP server. FTPClient封裝了所有必要的功能來存儲和檢索從FTP服務器上的文件。 This class takes care of all low level details of interacting with an FTP server and provides a convenient higher level interface.這個類負責所有與FTP服務器交互的底層細節,並提供了便捷的更高層次的接口。 As with all classes derived from SocketClient , you must first connect to the server with connect before doing anything, and finally disconnect after you're completely finished interacting with the server.正如來自所有類SocketClient ,您必須首先連接到與服務器connect做任何事之前,最后disconnect完成后,你完全與服務器交互。 Then you need to check the FTP reply code to see if the connection was successful.然后,你需要檢查的FTP答復代碼,看看是否連接成功。 For example:例如: 

    boolean error = false;布爾錯誤= 0;

    try {嘗試{

      int reply;詮釋答復;

      ftp.connect("ftp.foobar.com"); ftp.connect(“ftp.foobar.com”);

      System.out.println("Connected to " + server + "."); System.out.println(“連接到”+服務器+ ".");

      System.out.print(ftp.getReplyString()); System.out.print(ftp.getReplyString());

      // After connection attempt, you should check the reply code to verify / /連接嘗試后,你應該檢查代碼以驗證答復

      // success. / /成功。

      reply = ftp.getReplyCode();答復= ftp.getReplyCode();

      if(!FTPReply.isPositiveCompletion(reply)) {如果(!FTPReply.isPositiveCompletion(回復)){

        ftp.disconnect(); ftp.disconnect();

        System.err.println("FTP server refused connection."); System.err.println(“FTP服務器拒絕連接。”);

        System.exit(1); System.exit(1);

      } }

      ... ... // transfer files / /傳送文件

      ftp.logout(); ftp.logout();

    } catch(IOException e) { }捕捉(IOException異常五){

      error = true;誤差為真;

      e.printStackTrace(); e.printStackTrace();

    } finally {最后} {

      if(ftp.isConnected()) {如果(ftp.isConnected()){

        try {嘗試{

          ftp.disconnect(); ftp.disconnect();

        } catch(IOException ioe) { }捕捉(IOException異常雇主組織){

          // do nothing / /什么也不做

        } }

      } }

      System.exit(error ? 1 : 0); System.exit(錯誤1:0?);

    } }

 

Immediately after connecting is the only real time you need to check the reply code (because connect is of type void).連接后立即是唯一真正的時候你需要檢查答復代碼(因為是連接類型為void)。 The convention for all the FTP command methods in FTPClient is such that they either return a boolean value or some other value.對於所有的FTP FTPClient指揮方法的公約就是這樣,他們要么返回一個布爾值或其他值。 The boolean methods return true on a successful completion reply from the FTP server and false on a reply resulting in an error condition or failure.該方法返回一個布爾從FTP服務器成功完成答辯,假假真真的錯誤條件中的一個或故障而導致的答復。 The methods returning a value other than boolean return a value containing the higher level data produced by the FTP command, or null if a reply resulted in an error condition or failure.該方法返回一個布爾值返回值比含有較高水平的FTP命令,或者為null,如果產生一個錯誤條件答復或故障導致其他數據。 If you want to access the exact FTP reply code causing a success or failure, you must call getReplyCode after a success or failure.如果您要訪問的FTP的確切答復代碼導致成功或失敗,你必須調用getReplyCode后,成功或失敗。 

The default settings for FTPClient are for it to use FTP.ASCII_FILE_TYPE , FTP.NON_PRINT_TEXT_FORMAT , FTP.STREAM_TRANSFER_MODE , and FTP.FILE_STRUCTURE . FTPClient的默認設置是它使用FTP.ASCII_FILE_TYPE , FTP.NON_PRINT_TEXT_FORMAT , FTP.STREAM_TRANSFER_MODE和FTP.FILE_STRUCTURE 。 The only file types directly supported are FTP.ASCII_FILE_TYPE and FTP.BINARY_FILE_TYPE .唯一的文件直接支持的類型是FTP.ASCII_FILE_TYPE和FTP.BINARY_FILE_TYPE 。 Because there are at least 4 different EBCDIC encodings, we have opted not to provide direct support for EBCDIC.因為至少有4種不同的EBCDIC編碼,我們還選擇了不提供直接支持的EBCDIC。 To transfer EBCDIC and other unsupported file types you must create your own filter InputStreams and OutputStreams and wrap them around the streams returned or required by the FTPClient methods.為了轉移EBCDIC和其他不支持的文件類型,你必須創建自己的過濾InputStreams和OutputStreams和總結他們周圍的流退回或由FTPClient方法所需。 FTPClient uses the NetASCII filter streams to provide transparent handling of ASCII files. FTPClient使用NetASCII過濾器流提供ASCII文件透明處理。 We will consider incorporating EBCDIC support if there is enough demand.我們會考慮把EBCDIC碼的支持,如果有足夠的需求。 

FTP.NON_PRINT_TEXT_FORMAT , FTP.STREAM_TRANSFER_MODE , and FTP.FILE_STRUCTURE are the only supported formats, transfer modes, and file structures. FTP.NON_PRINT_TEXT_FORMAT , FTP.STREAM_TRANSFER_MODE和FTP.FILE_STRUCTURE是唯一支持的格式,傳輸模式和文件結構。 

Because the handling of sockets on different platforms can differ significantly, the FTPClient automatically issues a new PORT (or EPRT) command prior to every transfer requiring that the server connect to the client's data port.由於在不同平台上插座處理可以顯着差異,在FTPClient自動發出一個新的端口(或EPRT)命令之前,每次傳輸要求的服務器連接到客戶端的數據端口。 This ensures identical problem-free behavior on Windows, Unix, and Macintosh platforms.這將確保相同的Windows,Unix和Macintosh平台無故障的行為。 Additionally, it relieves programmers from having to issue the PORT (or EPRT) command themselves and dealing with platform dependent issues.此外,它解除不必發出端口(或EPRT)命令自己和與平台有關問題的程序員。 

Additionally, for security purposes, all data connections to the client are verified to ensure that they originated from the intended party (host and port).此外,為了安全起見,所有的數據連接到客戶端進行驗證,以確保他們打算從黨(主機和端口)起源。 If a data connection is initiated by an unexpected party, the command will close the socket and throw an IOException.如果一個數據連接是由黨發起的一個意外,該命令將關閉套接字並拋出一個IOException異常。 You may disable this behavior with setRemoteVerificationEnabled() .您可以禁用此行為setRemoteVerificationEnabled() 

You should keep in mind that the FTP server may choose to prematurely close a connection if the client has been idle for longer than a given time period (usually 900 seconds).你應該記住,在FTP服務器可以選擇過早關閉連接,如果客戶已超過給定的時間較長時期(通常為900秒)閑置。 The FTPClient class will detect a premature FTP server connection closing when it receives a FTPReply.SERVICE_NOT_AVAILABLE response to a command.將檢測的FTPClient類FTP服務器連接過早關閉,當它收到FTPReply.SERVICE_NOT_AVAILABLE響應命令。 When that occurs, the FTP class method encountering that reply will throw an FTPConnectionClosedException . FTPConnectionClosedException is a subclass of IOException and therefore need not be caught separately, but if you are going to catch it separately, its catch block must appear before the more general IOException catch block.一旦這種情況發生時,FTP類方法遇到的答復將拋出一個FTPConnectionClosedException 。 FTPConnectionClosedException是一個子類IOException ,因此不必分別被捕獲,但如果你要抓住它分開,它的catch塊必須出現在更一般的IOException catch塊。 When you encounter an FTPConnectionClosedException , you must disconnect the connection with disconnect() to properly clean up the system resources used by FTPClient.當你遇到一個FTPConnectionClosedException ,必須斷開與連接disconnect()妥善清理,系統資源使用FTPClient。 Before disconnecting, you may check the last reply code and text with getReplyCode , getReplyString , and getReplyStrings .在斷開,你可以檢查代碼和文本的最后答復與getReplyCode , getReplyStringgetReplyStrings 。 You may avoid server disconnections while the client is idle by periodically sending NOOP commands to the server.您可能會避免服務器斷開,而客戶端閑置的空操作指令通過定期發送到服務器。 

Rather than list it separately for each method, we mention here that every method communicating with the server and throwing an IOException can also throw a MalformedServerReplyException , which is a subclass of IOException.它不是單獨列出每個方法,我們在這里提到的每個方法與服務器通信,並拋出一個IOException異常也可引發MalformedServerReplyException ,這是一個IOException異常子類。 A MalformedServerReplyException will be thrown when the reply received from the server deviates enough from the protocol specification that it cannot be interpreted in a useful manner despite attempts to be as lenient as possible.將拋出一個MalformedServerReplyException答復時,從服務器收到的偏離足夠的協議規范,它不能在一個有用的方式解釋盡管試圖盡可能寬松。 

Listing API Examples Both paged and unpaged examples of directory listings are available, as follows:上市API的兩個例子的目錄列表分頁和無頁數的范例,如下: 

Unpaged (whole list) access, using a parser accessible by auto-detect:無頁數(全名單)訪問,使用分析器可經自動檢測: 

    FTPClient f = new FTPClient(); FTPClient f =new FTPClient();

    f.connect(server); f.connect(服務器);

    f.login(username, password); f.login(用戶名,密碼);

    FTPFile[] files = listFiles(directory); FTPFile []文件= listfiles <套件(目錄);

 

Paged access, using a parser not accessible by auto-detect.分頁訪問,使用分析器無法訪問的自動檢測。 The class defined in the first parameter of initateListParsing should be derived from org.apache.commons.net.FTPFileEntryParser:在應該從org.apache.commons.net.FTPFileEntryParser派生initateListParsing第一個參數定義的類: 

    FTPClient f = new FTPClient(); FTPClient f =new FTPClient();

    f.connect(server); f.connect(服務器);

    f.login(username, password); f.login(用戶名,密碼);

    FTPListParseEngine engine = FTPListParseEngine引擎=

       f.initiateListParsing("com.whatever.YourOwnParser", directory); f.initiateListParsing(“com.whatever.YourOwnParser”,目錄);

    while (engine.hasNext()) {而(engine.hasNext()){

       FTPFile[] files = engine.getNext(25); // "page size" you want FTPFile []文件= engine.getNext(25); / /“頁面大小”你想要

       //do whatever you want with these files, display them, etc. / /做你想做這些文件,顯示它們,等

       //expensive FTPFile objects not created until needed. / /昂貴FTPFile不創建對象,直到需要。

    } }

 

Paged access, using a parser accessible by auto-detect:分頁訪問,使用分析器可經自動檢測: 

    FTPClient f = new FTPClient(); FTPClient f =new FTPClient();

    f.connect(server); f.connect(服務器);

    f.login(username, password); f.login(用戶名,密碼);

    FTPListParseEngine engine = f.initiateListParsing(directory); FTPListParseEngine engine = f.initiateListParsing(目錄);

    while (engine.hasNext()) {而(engine.hasNext()){

       FTPFile[] files = engine.getNext(25); // "page size" you want FTPFile []文件= engine.getNext(25); / /“頁面大小”你想要

       //do whatever you want with these files, display them, etc. / /做你想做這些文件,顯示它們,等

       //expensive FTPFile objects not created until needed. / /昂貴FTPFile不創建對象,直到需要。

    } }

 

For examples of using FTPClient on servers whose directory listings有關使用服務器上的目錄清單FTPClient例子 

· use languages other than English使用英語以外的語言 

· use date formats other than the American English "standard" MM d yyyy使用日期格式“以外的美國英語”標准MM d yyyy 

· are in different timezones and you need accurate timestamps for dependency checking as in Ant在不同的時區,你需要在蟻群依賴檢查准確的時間戳 

see FTPClientConfig .FTPClientConfig 。 

Author: 作者: 

Daniel F. Savarese, Rory Winston丹尼爾樓Savarese,羅里溫斯頓 

See Also: 另見: 

FTP , FTPConnectionClosedException , FTPFileEntryParser , FTPFileEntryParserFactory , DefaultFTPFileEntryParserFactory , FTPClientConfig , MalformedServerReplyException FTP , FTPConnectionClosedException , FTPFileEntryParser , FTPFileEntryParserFactory , DefaultFTPFileEntryParserFactory , FTPClientConfig , MalformedServerReplyException 

 

Field Summary 字段摘要 

static int 

ACTIVE_LOCAL_DATA_CONNECTION_MODE 
A constant indicating the FTP session is expecting all transfers to occur between the client (local) and server and that the server should connect to the client's data port to initiate a data transfer.一個常量指示期待的FTP會話之間發生的所有傳輸客戶端(本地)和服務器,該服務器應該連接到客戶端的數據端口來啟動數據傳輸。 

static int 

ACTIVE_REMOTE_DATA_CONNECTION_MODE 
A constant indicating the FTP session is expecting all transfers to occur between two remote servers and that the server the client is connected to should connect to the other server's data port to initiate a data transfer.一個常量指示期待的FTP會話的所有轉讓發生在兩個遠程服務器,而客戶端連接到要連接到其他服務器的數據端口發起數據傳輸服務器。 

static int 

PASSIVE_LOCAL_DATA_CONNECTION_MODE 
A constant indicating the FTP session is expecting all transfers to occur between the client (local) and server and that the server is in passive mode, requiring the client to connect to the server's data port to initiate a transfer.一個常量指示期待的FTP會話之間發生的所有傳輸客戶端(本地)和服務器,服務器在被動模式時,要求客戶端連接到服務器的數據端口來啟動傳輸。 

static int 

PASSIVE_REMOTE_DATA_CONNECTION_MODE 
A constant indicating the FTP session is expecting all transfers to occur between two remote servers and that the server the client is connected to is in passive mode, requiring the other server to connect to the first server's data port to initiate a data transfer.一個常量指示期待的FTP會話的所有轉讓發生在兩個遠程服務器,而客戶端連接到處於被動模式,要求其他服務器連接到第一個服務器的數據端口發起數據傳輸服務器。 

 

Fields inherited from class org.apache.commons.net.ftp. FTP org.apache.commons.net.ftp類從繼承的字段。 的FTP 

_commandSupport_ , _controlEncoding , _controlInput_ , _controlOutput_ , _newReplyString , _replyCode , _replyLines , _replyString , ASCII_FILE_TYPE , BINARY_FILE_TYPE , BLOCK_TRANSFER_MODE , CARRIAGE_CONTROL_TEXT_FORMAT , COMPRESSED_TRANSFER_MODE , DEFAULT_CONTROL_ENCODING , DEFAULT_DATA_PORT , DEFAULT_PORT , EBCDIC_FILE_TYPE , FILE_STRUCTURE , LOCAL_FILE_TYPE , NON_PRINT_TEXT_FORMAT , PAGE_STRUCTURE , RECORD_STRUCTURE , STREAM_TRANSFER_MODE , strictMultilineParsing , TELNET_TEXT_FORMAT 

 

Fields inherited from class org.apache.commons.net. SocketClient org.apache.commons.net類從繼承的字段。 SocketClient 

_defaultPort_ , _input_ , _output_ , _serverSocketFactory_ , _socket_ , _socketFactory_ , _timeout_ , connectTimeout , NETASCII_EOL 

 

Constructor Summary 構造方法摘要 

FTPClient () 
Default FTPClient constructor.默認FTPClient構造。 

 

 

Method Summary 方法摘要 

protected void 

_connectAction_ () 
Initiates control connections and gets initial reply.啟動控制連接,並得到初步答復。 

protected Socket 

_openDataConnection_ (int command, String arg) 
Establishes a data connection with the FTP server, returning a Socket for the connection if successful.建立一個與FTP服務器的數據連接,如果返回的成功連接的Socket。 

boolean 

abort () 
Abort a transfer in progress.中止正在進行的傳輸。 

boolean 

allocate (int bytes) 
Reserve a number of bytes on the server for the next file transfer.保留一字節的下一個文件傳輸服務器數量。 

boolean 

allocate (int bytes, int recordSize) 
Reserve space on the server for the next file transfer.儲備空間,為下一個文件傳輸服務器。 

boolean 

appendFile ( String remote, InputStream local) 
Appends to a file on the server with the given name, taking input from the given InputStream.上的一個帶有特定名稱的服務器上的文件追加,即從定InputStream輸入。 

OutputStream 

appendFileStream ( String remote) 
Returns an OutputStream through which data can be written to append to a file on the server with the given name.返回一個通過該數據可以被寫入附加的帶有特定名稱的服務器上的文件的OutputStream。 

boolean 

changeToParentDirectory () 
Change to the parent directory of the current working directory.更改為當前工作目錄的父目錄。 

boolean 

changeWorkingDirectory ( String pathname) 
Change the current working directory of the FTP session.更改的FTP會話的當前工作目錄。 

boolean 

completePendingCommand () 
There are a few FTPClient methods that do not complete the entire sequence of FTP commands to complete a transaction.有幾個FTPClient方法不完成整個FTP命令序列來完成交易。 

void 

configure ( FTPClientConfig config) 
Implementation of the Configurable interface.實施Configurable界面。 

boolean 

deleteFile ( String pathname) 
Deletes a file on the FTP server.刪除在FTP服務器上的文件。 

void 

disconnect () 
Closes the connection to the FTP server and restores connection parameters to the default values.關閉到FTP服務器,連接參數恢復到默認值的連接。 

void 

enterLocalActiveMode () 
Set the current data connection mode to ACTIVE_LOCAL_DATA_CONNECTION_MODE .設置當前數據連接模式ACTIVE_LOCAL_DATA_CONNECTION_MODE 。 

void 

enterLocalPassiveMode () 
Set the current data connection mode to PASSIVE_LOCAL_DATA_CONNECTION_MODE .設置當前數據連接模式PASSIVE_LOCAL_DATA_CONNECTION_MODE 。 

boolean 

enterRemoteActiveMode ( InetAddress host, int port) 
Set the current data connection mode to ACTIVE_REMOTE_DATA_CONNECTION .設置當前數據連接模式ACTIVE_REMOTE_DATA_CONNECTION 。 

boolean 

enterRemotePassiveMode () 
Set the current data connection mode to PASSIVE_REMOTE_DATA_CONNECTION_MODE .設置當前數據連接模式PASSIVE_REMOTE_DATA_CONNECTION_MODE 。 

boolean 

features () 
Query the server for supported features.查詢支持的功能服務器。 

int 

getBufferSize () 
Retrieve the current internal buffer size.檢索當前的內部緩沖區的大小。 

int 

getDataConnectionMode () 
Returns the current data connection mode (one of the _DATA_CONNECTION_MODE constants.返回當前的數據連接模式(一_DATA_CONNECTION_MODE常數。 

protected String 

getListArguments ( String pathname) 

boolean 

getListHiddenFiles () 

String 

getModificationTime ( String pathname) 
Issue the FTP MDTM command (not supported by all servers to retrieve the last modification time of a file.問題的FTP MDTM命令(並非所有的服務器支持,以獲取一個文件的最后修改時間。 

String 

getPassiveHost () 
Returns the hostname or IP address (in the form of a string) returned by the server when entering passive mode.返回的主機名或IP地址(在一個字符串的形式)時,由服務器返回進入被動模式。 

int 

getPassivePort () 
If in passive mode, returns the data port of the passive host.如果在被動模式下,返回被動主機的數據端口。 

long 

getRestartOffset () 
Fetches the restart offset.擷取重新啟動所抵消。 

String 

getStatus () 
Issue the FTP STAT command to the server. STAT命令發出的FTP服務器。 

String 

getStatus ( String pathname) 
Issue the FTP STAT command to the server for a given pathname. STAT命令發出的FTP的服務器為給定的路徑名。 

String 

getSystemName () 
Deprecated. Use getSystemType() - which does not return null. 。棄用 使用getSystemType() -不返回null。 Will be deleted in version 3.0 將3.0版中刪除 

String 

getSystemType () 
Fetches the system type from the server and returns the string.從服務器獲取並返回字符串系統類型。 

FTPListParseEngine 

initiateListParsing () 
Using the default autodetect mechanism, initialize an FTPListParseEngine object containing a raw file information for the current working directory on the server This information is obtained through the LIST command.使用默認的自動檢測機制,初始化FTPListParseEngine對象,包含了當前工作的這些信息是通過LIST命令獲取服務器目錄中的原始文件信息。 

FTPListParseEngine 

initiateListParsing ( String pathname) 
Using the default autodetect mechanism, initialize an FTPListParseEngine object containing a raw file information for the supplied directory.使用默認的自動檢測機制,初始化FTPListParseEngine對象,包含了原始文件所提供的目錄信息。 

FTPListParseEngine 

initiateListParsing ( String parserKey, String pathname) 
Using the supplied parser key, initialize an FTPListParseEngine object containing a raw file information for the supplied directory.使用提供的解析器的關鍵,初始化FTPListParseEngine對象,包含了原始文件所提供的目錄信息。 

boolean 

isRemoteVerificationEnabled () 
Return whether or not verification of the remote host participating in data connections is enabled.返回不論是否在數據連接的遠程主機參加啟用驗證。 

boolean 

isUseEPSVwithIPv4 () 
Whether should attempt to use EPSV with IPv4.是否應該嘗試使用與IPv4 EPSV。 

FTPFile [] 

listFiles () 
Using the default system autodetect mechanism, obtain a list of file information for the current working directory.使用默認的系統自動檢測機制,獲取當前工作目錄的文件資料清單。 

FTPFile [] 

listFiles ( String pathname) 
Using the default system autodetect mechanism, obtain a list of file information for the current working directory or for just a single file.使用默認的系統自動檢測機制,獲取當前工作目錄或只是一個單一的文件檔案資料清單。 

FTPFile [] 

listFiles ( String pathname, FTPFileFilter filter) 
Version of listFiles(String) which allows a filter to be provided.從版本listFiles(String)它允許提供過濾器的人。 

String 

listHelp () 
Fetches the system help information from the server and returns the full string.從服務器獲取系統幫助信息並返回完整的字符串。 

String 

listHelp ( String command) 
Fetches the help information for a given command from the server and returns the full string.為獲取從服務器提供的命令的幫助信息,並返回完整的字符串。 

String [] 

listNames () 
Obtain a list of filenames in the current working directory This information is obtained through the NLST command.獲取當前工作目錄的文件名列表,這個信息是通過獲得NLST命令。 

String [] 

listNames ( String pathname) 
Obtain a list of filenames in a directory (or just the name of a given file, which is not particularly useful).獲取列表中一個目錄(或者僅僅是對一個給定的文件,它是不是特別有用的名稱)文件名。 

boolean 

login ( String username, String password) 
Login to the FTP server using the provided username and password.登錄到FTP服務器使用提供的用戶名和密碼。 

boolean 

login ( String username, String password, String account) 
Login to the FTP server using the provided username, password, and account.登錄到FTP服務器使用提供的用戶名,密碼和帳號。 

boolean 

logout () 
Logout of the FTP server by sending the QUIT command.注銷的通過發送QUIT命令FTP服務器。 

boolean 

makeDirectory ( String pathname) 
Creates a new subdirectory on the FTP server in the current directory (if a relative pathname is given) or where specified (if an absolute pathname is given).在上創建一個FTP服務器的當前目錄的子目錄(如果給出一個相對路徑名),或在指定的(如果給出一個絕對路徑名)。 

String 

printWorkingDirectory () 
Returns the pathname of the current working directory.返回當前工作目錄的路徑名。 

boolean 

remoteAppend ( String filename) 
Initiate a server to server file transfer.發起一個到服務器的文件傳輸服務器。 

boolean 

remoteRetrieve ( String filename) 
Initiate a server to server file transfer.發起一個到服務器的文件傳輸服務器。 

boolean 

remoteStore ( String filename) 
Initiate a server to server file transfer.發起一個到服務器的文件傳輸服務器。 

boolean 

remoteStoreUnique () 
Initiate a server to server file transfer.發起一個到服務器的文件傳輸服務器。 

boolean 

remoteStoreUnique ( String filename) 
Initiate a server to server file transfer.發起一個到服務器的文件傳輸服務器。 

boolean 

removeDirectory ( String pathname) 
Removes a directory on the FTP server (if empty).刪除在FTP服務器(如果是空的)目錄。 

boolean 

rename ( String from, String to) 
Renames a remote file.重命名遠程文件。 

boolean 

retrieveFile ( String remote, OutputStream local) 
Retrieves a named file from the server and writes it to the given OutputStream.從服務器檢索命名文件並將其寫入給定的OutputStream。 

InputStream 

retrieveFileStream ( String remote) 
Returns an InputStream from which a named file from the server can be read.返回從其中一個指定的文件從服務器可以讀取的InputStream。 

boolean 

sendNoOp () 
Sends a NOOP command to the FTP server.發送一個NOOP命令到FTP服務器。 

boolean 

sendSiteCommand ( String arguments) 
Send a site specific command.發送一個站點特定的命令。 

void 

setActiveExternalIPAddress ( String ipAddress) 
Set the external IP address in active mode.設置在主動模式下的外部IP地址。 

void 

setActivePortRange (int minPort, int maxPort) 
Set the client side port range in active mode.客戶端設置在主動模式端口范圍。 

void 

setBufferSize (int bufSize) 
Set the internal buffer size.設置內部緩沖區的大小。 

void 

setDataTimeout (int timeout) 
Sets the timeout in milliseconds to use when reading from the data connection.設置超時時間以毫秒為單位使用時,從數據連接讀。 

boolean 

setFileStructure (int structure) 
Sets the file structure.設置文件的結構。 

boolean 

setFileTransferMode (int mode) 
Sets the transfer mode.設置傳輸模式。 

boolean 

setFileType (int fileType) 
Sets the file type to be transferred.設置文件類型轉移。 

boolean 

setFileType (int fileType, int formatOrByteSize) 
Sets the file type to be transferred and the format.設置文件類型和格式傳送。 

void 

setListHiddenFiles (boolean listHiddenFiles) 
You can set this to true if you would like to get hidden files when listFiles(java.lang.String) too.您可以設置為true,如果你想獲得隱藏的文件時listFiles(java.lang.String)了。 

boolean 

setModificationTime ( String pathname, String timeval) 
Issue the FTP MFMT command (not supported by all servers) which sets the last modified time of a file.問題的FTP MFMT命令(並非所有服務器都支持)中規定的最后修改文件的時間。 

void 

setParserFactory ( FTPFileEntryParserFactory parserFactory) 
set the factory used for parser creation to the supplied factory object.為創建為所提供的解析器工廠對象所使用的工廠。 

void 

setRemoteVerificationEnabled (boolean enable) 
Enable or disable verification that the remote host taking part of a data connection is the same as the host to which the control connection is attached.啟用或禁用核實,利用遠程主機的數據連接部分是作為控制連接到該連接的主機是相同的。 

void 

setRestartOffset (long offset) 
Sets the restart offset.設置重新啟動所抵消。 

void 

setUseEPSVwithIPv4 (boolean selected) 
Set whether to use EPSV with IPv4.設置是否使用與IPv4 EPSV。 

boolean 

storeFile ( String remote, InputStream local) 
Stores a file on the server using the given name and taking input from the given InputStream.存儲一個使用給定的名稱,並采取從給定的InputStream輸入服務器的文件。 

OutputStream 

storeFileStream ( String remote) 
Returns an OutputStream through which data can be written to store a file on the server using the given name.返回一個通過該數據可以被寫入存儲在使用給定的名稱服務器上的文件的OutputStream。 

boolean 

storeUniqueFile ( InputStream local) 
Stores a file on the server using a unique name assigned by the server and taking input from the given InputStream.使用上存儲一個唯一的名稱由服務器和從給定的InputStream輸入到指定的服務器上的文件。 

boolean 

storeUniqueFile ( String remote, InputStream local) 
Stores a file on the server using a unique name derived from the given name and taking input from the given InputStream.使用上存儲一個唯一的名稱從給定的名稱和給定的InputStream輸入導出到服務器上的文件。 

OutputStream 

storeUniqueFileStream () 
Returns an OutputStream through which data can be written to store a file on the server using a unique name assigned by the server.通過返回一個可寫入的數據存儲上使用一個唯一的名稱由服務器分配服務器上的文件的OutputStream。 

OutputStream 

storeUniqueFileStream ( String remote) 
Returns an OutputStream through which data can be written to store a file on the server using a unique name derived from the given name.通過返回一個可寫入的數據存儲上使用一個唯一的名稱從給定的名稱派生服務器上的文件的OutputStream。 

boolean 

structureMount ( String pathname) 
Issue the FTP SMNT command.問題的FTP SMNT命令。 

 

Methods inherited from class org.apache.commons.net.ftp. FTP 從類繼承的方法org.apache.commons.net.ftp。 FTP的 

abor , acct , addProtocolCommandListener , allo , allo , appe , cdup , cwd , dele , eprt , epsv , feat , getControlEncoding , getReply , getReplyCode , getReplyString , getReplyStrings , help , help , isStrictMultilineParsing , list , list , mdtm , mfmt , mkd , mode , nlst , nlst , noop , pass , pasv , port , pwd , quit , rein , removeProtocolCommandListener , rest , retr , rmd , rnfr , rnto , sendCommand , sendCommand , sendCommand , sendCommand , setControlEncoding , setStrictMultilineParsing , site , smnt , stat , stat , stor , stou , stou , stru , syst , type , type , user 

 

Methods inherited from class org.apache.commons.net. SocketClient 從類繼承的方法org.apache.commons.net。 SocketClient 

connect , connect , connect , connect , connect , connect , getConnectTimeout , getDefaultPort , getDefaultTimeout , getKeepAlive , getLocalAddress , getLocalPort , getRemoteAddress , getRemotePort , getServerSocketFactory , getSoLinger , getSoTimeout , getTcpNoDelay , isConnected , setConnectTimeout , setDefaultPort , setDefaultTimeout , setKeepAlive , setReceiveBufferSize , setSendBufferSize , setServerSocketFactory , setSocketFactory , setSoLinger , setSoTimeout , setTcpNoDelay , verifyRemote 

 

Methods inherited from class Java.lang. Object java.lang中的類繼承的方法。 對象 

clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM