package TestIO;
import java.io.*;
public class Test01 {
public static void main(String[] args) throws Exception {
////内容是:abcdefg
String filepath= "D:\\test.txt";
//创建流
FileInputStream fis= new FileInputStream(filepath);
//创建数组
byte[] bytes = new byte[3];
fis.read(bytes);//该方法返回int类型的值代表的是这次读取了多少字节。
System.out.println(new String(bytes));
fis.read(bytes);//abc
System.out.println(new String(bytes));
int s =fis.read(bytes);//def
System.out.println(new String(bytes,0,s));//从0开始,读取S个
fis.close();
}
}