public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
InputStream in = null;
File f = new File("D:/test.txt");
byte[] b = new byte[2];
in = new FileInputStream(f);
int i = 0;
while ((i = in.read(b)) != -1) {
String str = new String(b);
System.out.print(str);
}
}12行,数组b里缓存的数据在input的过程中不断变化,那么字符串str怎么能获取读入的所有数据呢?
添加回答
举报
0/150
提交
取消