FTPClient

来源:互联网 发布:目前java主流开发框架 编辑:程序博客网 时间:2024/04/30 14:49

1.ftp二进制上传和基本命令

ASCII 模式和BINARY模式的区别是回车换行的处理,binary模式不对数据进行任何处理,asci模式将回车换行转换为本机的回车字符,比如Unix下是\n,Windows下是\r\n,Mac下是\r 

2.ftp上传的部分方法

senCommand:method inherited from FTP 发送命令给ftp,
fileType 目前只有两种,一种 FTP.ASCII_FILE_TYPE ,一种 FTP.BINARY_FILE_TYPE
currently calling any connect method will reset the type to FTP.ASCII_FILE_TYPE

setControlEncoding(String encoding) Sets the character encoding used by the FTP control connection
logout() Logout of the FTP server by sending the QUIT command.
disconnect()  Closes the connection to the FTP server and restores connection parameters to the default values.

storeFile(String fileName,InputStream local);  This method does NOT close the given InputStream. If the current file type is ASCII, line separators in the file are transparently converted to the NETASCII format 

retrieveFile(String remote,OutputStream local)   Retrieves a named file from the server and writes it to the given OutputStream

FTPListParseEngine

The first part is comprised of reading the raw input into an internal list of strings.
The second part is composed of the actual parsing, again in conjunction with the particular parser used by this engine.

inputstream 是用来读取的 read    outputstream 是用来输出的   copyStream可以将两者互换

byteArrayInputstream 可以讲字符串变为输入流

0 0
原创粉丝点击