package com.itheima.exam1.io;
import java.io.*;
public class XuXie
{
/**new FileOutputStream(file,true)字节流file文件后续写
new FileWriter(file,true);字符流文件后续写
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException
{
File file=new File("D:\\3.txt");
//new FileOutputStream(file,true)字节流file文件后续写
// new FileWriter(file,true);字符流文件后续写
PrintStream ps = new PrintStream(new BufferedOutputStream(new FileOutputStream(file,true)));
String str ="sfefsefsefsefs9902844";
byte[] buf= str.getBytes();
ps.write(buf);
ps.flush();
ps.close();
}
}
|
文件后面续写的小问题
最新推荐文章于 2021-02-21 06:01:24 发布