InputStreamReader

import java.io.*;

public class Demo02InputStreamReader {
    public static void main(String[] args) throws IOException {

        InputStreamReader ifr =new InputStreamReader(new FileInputStream("F:\\basic\\untitled13\\src\\it\\cast\\day15\\demo05\\a.txt"),"GBK");
//读取GBK文件,默认读取UTF-8格式编码文件
int len=0; while ((len=ifr.read())!=-1){ System.out.println((char) len); } ifr.close(); } }

 

posted @ 2020-10-11 21:11  159566  阅读(145)  评论(0)    收藏  举报