简单问题。关于IO的
怎么把文件内容读取到byte[]中,最合适。
DataInputStream in =new DataInputStream(new BufferedInputStream(
new FileInputStream("aaa.txt")));
byte[] bytes = new byte[1024*2];
char[] chars = null;
for(int j=0;;j++){
if(in.available()!=0)
bytes[j] = in.readByte();
else
break;
}
........
我这样做合适吗?大家都批评,
可不可以根据aaa.txt的大小,确定byte的空间呢?