import java.io.*;
/**
* 转换流指定编码读写文件
*/
public class Demo1 {
public static void main(String[] args) throws IOException {
FileInputStream fileInputStream = new FileInputStream("C:\\Users\\Administrator\\Desktop\\coverage-error.log");
InputStreamReader input = new InputStreamReader(fileInputStream, "gbk");
int c;
while ((c = input.read()) != -1) {
System.out.println((char) c);
}
fileInputStream.close();
input.close();
}
}
转换流指定编码读写文件
最新推荐文章于 2022-04-18 09:49:54 发布