#6 InputStreamInStream returns partial data

open
nobody
None
5
2011-03-31
2011-03-31
Daniel Truitt
No

The InputStreamInStream does not always fill the supplied buffer. The code for the read method should look like this:

public void read(byte[] buf) throws IOException {
int off = 0;
int len = buf.length;
while(off < len) {
off += is.read(buf, off, len - off);
}
}

Discussion