如何在Java FileOutputStream中编写新行 [英] How to write new line in Java FileOutputStream

查看:135
本文介绍了如何在Java FileOutputStream中编写新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 FileOutputStream 写一个新行;我尝试了以下方法,但它们都没有工作:

I want to write a new line using a FileOutputStream; I have tried the following approaches, but none of them are working:

encfileout.write('\n');
encfileout.write("\n".getbytes());
encfileout.write(System.getProperty("line.separator").getBytes());


推荐答案

这可能是观众问题...尝试打开EditPlus或Notepad ++中的文件。 Windows记事本可能无法识别其他操作系统的换行符。您现在在哪个程序中查看该文件?

It could be a viewer problem... Try opening the file in EditPlus or Notepad++. Windows Notepad may not recognise line feed of another operating system. In which program are you viewing the file now?

这篇关于如何在Java FileOutputStream中编写新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆