(InputStream is, byte[] buf, int pos, int n)
| 403 | } |
| 404 | |
| 405 | protected boolean read(InputStream is, byte[] buf, int pos, int n) throws IOException { |
| 406 | |
| 407 | int read = 0; |
| 408 | int res = 0; |
| 409 | while (read < n) { |
| 410 | res = is.read(buf, read + pos, n - read); |
| 411 | if (res > 0) { |
| 412 | read += res; |
| 413 | } else { |
| 414 | throw new IOException("Read failed"); |
| 415 | } |
| 416 | } |
| 417 | return true; |
| 418 | } |
| 419 | } |