FileInputStream fi = new FileInputStream("src/text");
byte[] bytes1 = fi.readAllBytes();//API
System.out.println(new String(bytes1));
//桶装水
byte[] bytes=new byte[(int) file.length()];//定义桶的大小
int i;
while ((i=fi.read(bytes))!=-1) {
String st=new String(bytes,0,i);
System.out.print(st);
}
```java