package com.sxt;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* 字节输入流
* @author Administrator
*
*/
public class InputStreamDemo {
public static void main(String[] args) throws IOException {
//创建一个对象
File f = new File(“c:/a/a.txt”);
FileInputStream fis=new FileInputStream(f);
//读取 每次一个字节
int len=0;
byte[] b=new byte[1024];
while ((len=fis.read(b))!=-1) {
//把byte转为String类型
System.out.println(new String(b));
}
fis.close();
}
}