我正在寻找一个可以在 android 上运行的 java 库,它可以从 FTP 服务器下载和恢复文件.有谁知道这样的图书馆.我发现了很多客户端应用程序,但没有独立的库.
I'm looking for a java library that works on the android that can download and resume files from an FTP server. Does anyone know of such a library. I've found lots of client apps, but no stand alone libraries.
尝试使用 apache commons ftp
FTPClient ftpClient = new FTPClient();
ftpClient.connect(InetAddress.getByName(server));
ftpClient.login(user, password);
ftpClient.changeWorkingDirectory(serverRoad);
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
BufferedInputStream buffIn = null;
buffIn = new BufferedInputStream(new FileInputStream(file));
ftpClient.enterLocalPassiveMode();
ftpClient.storeFile("test.txt", buffIn);
buffIn.close();
ftpClient.logout();
ftpClient.disconnect();
这篇关于Android FTP 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!