import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class io_stream {
public static void main(String[] args) {
try {
FileInputStream file = new FileInputStream("C:\\Users\\Bi-Hu\\Desktop\\1.txt");
byte[] arr = new byte[20];
int temp = 0;
while((temp = file.read(arr)) != -1){
System.out.print(new String(arr,0,temp));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Io流 FileInputStream 用read(byte[] b) 读文件
它读完返回成功读了多少个的
至于new String (byte[] , x , y);
就是那么回事…