/** * 使用InputStreamReader解决格式乱码! */ import java.io.*; public class InputStreamReaderTest { public static void main(String[] args) throws IOException { FileInputStream file = new FileInputStream("E://d.txt");//首先,获取文件。 InputStreamReader isr = new InputStreamReader(file,"Unicode");//将读取文件的格式转换为文件的格式, int temp; while ((temp=isr.read())!=-1){//循环遍历 System.out.print((char)temp);//输出文件里的内容 } isr.close();//关闭isr file.close();//关闭file } }
使用InputStreamReader解决格式乱码
猜你喜欢
转载自blog.csdn.net/gadxiong/article/details/80098161
今日推荐
周排行