Android FTP库
发布于 2021-02-02 22:53:21
我正在寻找一个可以在android上运行的java库,它可以从FTP服务器下载和恢复文件。有人知道这样的libraries吗。我发现了很多客户端应用程序,但没有独立的库。
关注者
0
被浏览
312
1 个回答
-
尝试使用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();