zoukankan      html  css  js  c++  java
  • 字符输入流 FileReader

    package cn.lideng.demo3;
    
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    
    
    
    public class WriterDemo1 {
        public static void main(String[] args) throws Exception {
            
                FileReader fr=new FileReader("d:\b.txt");
                int len=0;
                while((len=fr.read())!=-1){
                    System.out.println((char)len);
            
                }
                /*char[] c=new char[1024];
                int len=0;
                while((len=fr.read(c))!=-1){
                    System.out.println(new String(c,0,len));
                }
                fr.close();*/
                //flush 和 close 区别
                //flush用来刷新缓冲区 只有字符流才需要刷新
                
        }
    
    }
  • 相关阅读:
    补码原理
    清风徐来,水波不兴
    月尾和周尾
    又一春又一季
    9.11
    晨光无限
    9.18
    心悠
    小事一桩
    一周岁啦
  • 原文地址:https://www.cnblogs.com/qurui1998/p/10596214.html
Copyright © 2011-2022 走看看