private void putASCII(InputStream srcStream, String remoteFile,
boolean append)
throws IOException, FTPException {
// need to read line by line ...
LineNumberReader in
= new LineNumberReader(new InputStreamReader(srcStream));
initPut(remoteFile, append);
// get an character output stream to write to ... AFTER we
// have the ok to go ahead AND AFTER we've successfully opened a
// stream for the local file
BufferedWriter out =
new BufferedWriter(
new OutputStreamWriter(data.getOutputStream()));
// write line by line, writing \r\n as required by RFC959 after
// each line
String line = null;
while ((line = in.readLine()) != null) {
out.write(line, 0, line.length());
out.write(FTPControlSocket.EOL, 0, FTPControlSocket.EOL.length());
}
in.close();
out.flush();
out.close();
// and close the data socket
try {