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));

相关文章:

  • 2022-12-23
  • 2022-03-01
  • 2021-05-17
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-15
  • 2022-12-23
  • 2021-11-20
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
相关资源
相似解决方案