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();
}
}
FileOutputStream写到文件
最新推荐文章于 2023-05-13 06:44:00 发布