()
| 54 | } |
| 55 | |
| 56 | @Override |
| 57 | public int read() throws IOException { |
| 58 | if (decoder.closed) { |
| 59 | throw new IOException("read after close"); |
| 60 | } |
| 61 | int decoded; |
| 62 | // Iterate until at least one byte is decoded, or EOF reached. |
| 63 | while (true) { |
| 64 | decoded = decoder.decode(); |
| 65 | if (decoded != 0) { |
| 66 | break; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | if (decoded == -1) { |
| 71 | return -1; |
| 72 | } |
| 73 | return decoder.buffer.get() & 0xFF; |
| 74 | } |
| 75 | |
| 76 | @Override |
| 77 | public int read(byte[] b) throws IOException { |