我在我的ftp服務器上有文本文件。我試圖寫入這個文件,但不能。這是我的代碼。在Java中的ftp服務器上寫入文本文件
URL url = new URL("ftp://username:[email protected]/public/foler/a.txt;type=i");
URLConnection urlc = url.openConnection();
OutputStream os = urlc.getOutputStream(); // To upload
OutputStream buffer = new BufferedOutputStream(os);
ObjectOutput output = new ObjectOutputStream(buffer);
output.writeChars("hello");
buffer.close();
os.close();
output.close();