java - Apache Commons Net - System.getProperty("line.separator") - does not work in Android -
i utilize apache commons api append new line file using ftpclient class. when run next code in java, new line appended file on ftp server. however, when run same code in android, string appended file without new line.
why new line using - system.getproperty("line.separator") - not transferred via ftp under android?
also, new line correctly displayed in logcat not work in txt file on ftp server. maybe there difference in character encoding between java , android?
thank much.
string log = system.getproperty("line.separator") + "blablabla"; boolean done = ftpclient.appendfile("log.txt", new bytearrayinputstream(log.getbytes("utf-8"))); system.out.println("log: " + log);
as file on server, wouldn't think you'd want client's value of system.getproperty("line.separator");
want know line separator on server is, you're working (apparently) in binary mode , ftp middle layer can't line-ending conversions you. (which once — perchance still is — quite mutual thing ftp clients , servers do; called "ascii" mode. [ah, halcyon days, when thought assume text in ascii, despite knowing, deep down, that wasn't sustainable... two-digit years...])
you either query info server, or take utilize particular line separator in server-side log file. if latter, \n
selection if you're using *nix-based server. if you're on microsoft stack on server, \r\n
improve choice.
java android ftp apache-commons-net
No comments:
Post a Comment