데이터 전환에 파일을 사용하는 응용 프로그램의 경우 FTP 서버를 사용하는 것이 매우 좋습니다.
FileZilla Server 서버의 자세한 구성 프로세스는 FileZilla Server 설치 구성 자습서를 참조하십시오. 일부 친구들은 FTP 서버에 큰 파일을 업로드하기 전에 이름을 바꿀 수없는 문제를 재현 할 수 있지만 Filezilla 서버에 2G 파일을 업로드하는 것을 개인적으로 테스트합니다 암호.
favftputil.java
com.favccxx.favsoft.util; net.ftp.ftpclient; 주소* @param port ftp 서버 포트 번호* @param username ftp 계정 번호* @param password ftp 로그인 암호* @param pathname f tp server 저장 디렉토리* @param filename ftp 서버에 업로드 한 후 파일 이름 파일 스트림*/ public static boolean uploadfile (String hostname, int port, string username, string postname, String filename, inputStream inputStream) {ftpclient = new ftpclient (); SetControleEncoding ( "UTF-8") {// ftpclient.connect (portname, port); .GetReplyCode (! ftpreply.ispositivecode) {retains. binary_file_type. inputStream.close (); ftpclient.logout (); .printstacktrace ();}} return flag;} /*** 파일 업로드 파일 (파일 이름 바꾸기)* @param hostname ftp 서버 주소* @param port ftp 서버 포트 번호* @param username 로그인 계정* @param 비밀번호 ftp 로그인 비밀번호 * @param pathname ftp server는 디렉토리를 저장합니다 * @param filename 서버 다음에 파일 이름을 ftp에 업로드 * @param originfilename 업로드 파일의 이름 (절대 주소) */ public static boolean uploadfilefromproduction (String hostname, int port , String Password, String PathName, String OrigineFileName) {Boolean Flag = inputStream inputStream = New File (originFilename); ;} catch event e) {e.printstacktrace ();} return flag;} /* ** 파일 업로드 파일 (파일의로드)* @param hostname ftp 서버 주소* @param port ftp 서버 번호* @param username ftp 로그인 계정 번호 * @Param 비밀번호 FTP 로그인 암호 * FTP 서버 저장 디렉토리 * @param originfilename 이름 (절대 주소) * @return */ public static boolean uploadfilefromProduction (문자열 포트, 문자열 사용자 이름, 문자열, 문자열, 문자열 사용자 이름 OriginFilename {boolean flage = string filename = new file (). ;} catch (예외 e) {e.printstacktrace ();} return flag;} /*** 파일 삭제* @param hostname ftp 서버 주소* @param port ftp 서버 포트 번호* @param username ftp ssword ftp 로그인 암호* @ @ @ s param pathname ftp server 파일 이름* @ return*/ public static boolean deletefile (string hostname, int port, string username, string string, String filename) {boolean FALSE;; int replycode = getReplyCode (! = true;} catch (예외 e) {e.printstacktrace ();} 마침내 {if (ftpclient.isconnect ()) {try {ftpclient.logout ();} catch (ioexception e) {}}}}}}}}} } rn flag;} /*** 다운로드 파일* @param hostname ftp 서버 주소* @param port ftp 서버 포트 번호* @param username ftp 계정 번호* @param password ftp 로그인 암호* @param pathname ftp 서버 파일 디렉토리* @ PARM FIL ENAME 파일 이름 * @Param LocalPath 파일 경로 * @return */ public static boolean downloadfile (문자열 호스트 이름, int 포트, 문자열 사용자 이름, 문자열 파일 이름, 문자열 l ocalpath) {boolean flag = false; 새 ftpclient (); .getRepl ycode (); if (! ftpreply. ispositiveCode) {return flag;} // switch ftpclient.changeworkingDirectory (pathName); s (); getName () {localPILE + "/" + file.getName ()); logout (); flag = true;} catch (예외 e) {e.printstacktrace ();} 마지막 {if (ftpclient.isconnected ())) {try {ftpcli. {}}} return flag;}}favftputiltest.java
com.favccxx.favsoft.util; "Business"; Stringname = "business/ebook"; "big.rar"; 사용자 이름, pathName, filename, originfilename);
위는이 기사의 모든 내용입니다.