我正在使用此代码读取输入流,但它不工作它在缓冲区中给出垃圾值。下面的代码有什么问题: //mInputStream 是 FileInputStream 的一个对象
buf = new byte[4];
int ret = 0;
l("run");
try {
while ( (ret = mInputStream.read(buf) )!= -1) {
l("No.of bytes received:"+ret);
l("Data received length :"+buf.length);
l("Data received: "+buf.toString());
}
} catch (IOException e) {
l("IO exception in receiving");
}