import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
//字符流写数据的五种方式
public class OutputStreamWrite1 {
public static void main(String[] args) throws IOException {
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream("E:\\Workpace\\abc.txt"));
//outputStreamWriter = new OutputStreamWriter(new FileOutputStream("E:\\Workpace\\abc.txt"), StandardCharsets.UTF_8);
//1.单个写入
outputStreamWriter.write("a");
//2.数组写入
char c[] = {'a','v','c','e'};
outputStreamWriter.write(c);
//3.写入数组一部分
outputStreamWriter.write(c,1,3);
//4.字符串写入
outputStreamWriter.write("中国");
//5.字符串的一部分
outputStreamWriter.write("中国",0,1);
outputStreamWriter.flush();
outputStreamWriter.close();
}
}