IO流-FileInputStream

package com.day17.IO;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class IOFileInputStream {

  public static void main(String[] args) throws IOException {
    FileInputStream fis=new FileInputStream("zhujialei.txt");//创建字节流
    /* int x=fis.read();//从硬盘上读取一个字节
    System.out.println(x);//97
    int y=fis.read();
    System.out.println(y);//98
    */
    int b;
    while((b=fis.read())!=-1) {
      System.out.println(b);//97 98 99
    }
    fis.close();//关流释放资源
  }

}

posted @ 2018-05-29 21:01  简简单单zjl  阅读(109)  评论(0编辑  收藏  举报