http://www.iteye.com/topic/190329
看了下楼主的需求,感觉上面那位仁兄写的太麻烦了,写了一个方法,你看下如何
public static byte[] read(int speed,InputStream fin) throws IOException{
byte[] b = new byte[speed];
ByteArrayOutputStream out = new ByteArrayOutputStream();
int len = 0;
while(fin.available() >0){
len = fin.read(b);
out.write(b,0,len);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return out.toByteArray();
}
321

被折叠的 条评论
为什么被折叠?



