import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
public class work {
public static void main(String[] args) throws IOException {
//创建一个输入流对象
FileInputStream fis = new FileInputStream("D:\\a.txt");
BufferedInputStream bis = new BufferedInputStream(fis);
//读内容(一个字节)
/* int i = bis.read();
while (i != -1){
System.out.print((char)i);
}
*/
//读一个字节数组
byte[] b = new byte[5];
int count = bis.read(b);//count指的是实际读取字节的个数
//读到的内容已经放到字节数组b中
//把字节数组b——>字符串
String string = new String(b,0,count);
System.out.println(string);
//关闭流
bis.close();
fis.close();
}
}