File f = new File("E:"+File.separator+"java2"+File.separator+"StreamDemo"+File.separator+"test.txt");
InputStream in = new FileInputStream(f);
byte b[]=new byte[(int)f.length()]; //创建合适文件大小的数组
in.read(b); //读取文件中的内容到b[]数组
in.close();
System.out.println(new String(b));
InputStream in = new FileInputStream(f);
byte b[]=new byte[(int)f.length()]; //创建合适文件大小的数组
in.read(b); //读取文件中的内容到b[]数组
in.close();
System.out.println(new String(b));