您的位置:首页 > 编程语言 > PHP开发

FileOutputStream写到文件

2015-10-09 11:00 501 查看
File f=new File("e:/abc.txt");
FileOutputStream fos=null;
try {
fos=new FileOutputStream(f);
if(f.exists())
{
System.out.println("文件已存在");
}

byte b[]=new byte[1024];

String s="阿什顿飞规划局快乐\r\n";
String s2="阿什顿飞规划局快乐";
//	b=	s.getBytes();

fos.write(s.getBytes());
fos.write(s2.getBytes());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally
{
try {
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: