FileInputStream输入流的使用

package exer;
输入流
import java.io.File;
public class FileInputStream {
public static void main(String[] args) {
    FileInputStream fis=null;
    try {
        File file =new File("hello.txt");
        fis = new FileInputStream();
        byte[] b=new byte[5];//读取的数据要存入的数组
        int len;//每次读入到byte字节中的长度
        while((len = fis.read(b)!=-1)){
            for(int i=0;i<=len;i++){
            System.out.print( (char) b[i]);
        }
        }
    } catch (Exception e) {
        
        e.printStackTrace();
    }finally{
        if(fis!=null)
            try {
                fis.close();
            } catch (Exception e) {
                
                e.printStackTrace();
            }
    }
    
        
    
    }
}
原文地址:https://www.cnblogs.com/alhh/p/5512572.html