【发布时间】:2013-09-27 14:03:43
【问题描述】:
我正在将一个文件从 android 设备写入 windows 文件夹
所有内容都完好无损
但我无法写新行
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null,nam,p);
file = new SmbFile(url, auth);
SmbFileOutputStream out = new SmbFileOutputStream(file,true);
我试过了:
out.write(("next"+ "\n" + text).getBytes());
out.write(("next"+String.format("%n") + text).getBytes());
out.write(("next"+System.getProperty("line.separator") + text).getBytes());
out.flush();
out.close();
但似乎没有任何工作,请帮助。
【问题讨论】:
-
只是在这里猜测,但您尝试过
\r\n吗?或者,您可以使用PrintWriter包装out变量并使用其println()方法 -
确定@gnobal! 我已经尝试过: 在上面的代码中,仔细看它确实存在
-
PrintWriter pw = new PrintWriter(out);pw.println();根本没有写文字,因为它的SmbFileOutputStream而不是javaOutputStream我认为