我正在开发一个项目,用户可以上传自己的文件等。 我想列出所有文件的列表。 但我如何在FTP服务器上的文本文件中写入? 继承我的代码:
public static void write(String url, String password, String name, String text, String pathOnServer) {
FTPClient client = new FTPClient();
try {
client.connect(url, 21);
client.login(name, password);
OutputStream out1 = client
.storeFileStream("/Centio/Configs/User/" + UsernameUtil.getUsername() + "/ConfigList.txt");
BufferedWriter bufferedWriter1 = new BufferedWriter(new OutputStreamWriter(out1));
bufferedWriter1.write(text);
bufferedWriter1.newLine();
bufferedWriter1.close();
out1.close();
} catch (Exception e) {
// TODO: handle exception
}
}