java指定编码格式读取和写入文件

这里以UTF-8为例:

BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(desFile)), "UTF-8"));
//BufferedWriter bw=new BufferedWriter(new FileWriterWithEncoding(new File(decFile), "UTF-8"));

你可能感兴趣的:(编程,java)