//File对象定位数据源
public static void getContent(File file) throws IOException {
//创建文件缓冲输入流
file BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
byte[] buf = new byte[1024];//创建字节数组,存储临时读取的数据
int len = 0;//记录数据读取的长度
//循环读取数据
while((len = bis.read(buf)) != -1) { //长度为-1则读取完毕
System.out.println(new String(buf,0,len));
}
bis.close(); //关闭流
}