File f = new File("src/abc.txt");
// project structure/Modules/ Use modules compile output path选中即显示相对路径
InputStream io = new FileInputStream(f);
byte[] flush= new byte[4];
int len = -1;
//io.read()末尾返回-1,其他返回相应int
while((len = io.read(flush))!=-1){
//len不可少 否则会在byte[]后附加
System.out.print(new String(flush,0,len)+" ");
}
io.close();
字节流字节数组
猜你喜欢
转载自blog.csdn.net/zzzfeiyu/article/details/94628851
今日推荐
周排行