import java.io.*;
import java.nio.Buffer;
/**
* 使用字节缓冲流读取
* BufferedInputStream
* @author cg
*/
public class Demo04 {
public static void main(String[] args) throws IOException {
//1.创建BufferedInputStream
FileInputStream fis = new FileInputStream("c:\\Users\\cheng\\Desktop\\code\\aaa.txt");
BufferedInputStream bis = new BufferedInputStream(fis);
//2.
/* int date = 0;
while ((date=bis.read())!=-1){
System.out.print((char)date);
}*/
//自己创建缓存区
int count = 0;
byte[] buffer = new byte[1024];
while ((count= bis.read(buffer))!=-1){
System.out.println(new String(buffer,0,count));
}
//3.关闭资源
bis.close();
}
}