Name: gsC80088 Date: 11/24/98
java.io.InputStream read(byte[]...)
methods declare but do not throw
java.io.IOException
notice overloaded read(byte[]...) methods
actual implementation:
public int read(byte b[], int off, int len) throws IOException {
if (len <= 0) {
return 0;
}
int c = read();
if (c == -1) {
return -1;
}
b[off] = (byte)c;
int i = 1;
try {
for (; i < len ; i++) {
c = read();
if (c == -1) {
break;
}
if (b != null) {
b[off + i] = (byte)c;
}
}
} catch (IOException ee) {
}
return i;
}
the try/catch blocks cause an intercept of the
IOException without passing the exception up
the stack. See:
catch (IOException ee) { }
This in effect eats the exception, taking no action
and prevents notification beyond the scope of
this method.
(Review ID: 43377)
======================================================================
- duplicates
-
JDK-4008296 java.io.XXXXInputStream.read(b,off,len) methods work wrong with off, len
-
- Closed
-