BufferedOutputStream 和 FileOutputStream写入二进制字节
方法定义
public BufferedOutputStream(OutputStream out) {
示例
BufferedOutputStream writer = new BufferedOutputStream(new FileOutputStream("demo.txt"));
writer.write("hello world".getBytes());
writer.close();
PrintWriter写入文本字符
方法定义
public PrintWriter(String fileName) throws FileNotFoundException{
}
示例
PrintWriter writer = new PrintWriter("demo.txt");
writer.write("hello world");
writer.close();