package Zy; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class Zy03 { //3.用转换流复制一个UTF-8的txt文件 public static void main(String[] args) throws IOException { FileInputStream fis=new FileInputStream("d:\\java\\456.txt"); InputStreamReader isr=new InputStreamReader(fis,"utf-8"); FileOutputStream fos=new FileOutputStream("e:\\java\\456.txt",true); OutputStreamWriter osw=new OutputStreamWriter(fos,"utf-8"); char[] ch=new char[1024]; int len=0; while((len=isr.read(ch))!=-1){ osw.write(ch, 0, len);; osw.flush(); } osw.close(); isr.close(); } }
javaee utf-8文件的转换
猜你喜欢
转载自www.cnblogs.com/hankai2735/p/9224796.html
今日推荐
周排行