(long n)
| 101 | } |
| 102 | |
| 103 | @Override |
| 104 | public long skip(long n) throws IOException { |
| 105 | if (decoder.closed) { |
| 106 | throw new IOException("read after close"); |
| 107 | } |
| 108 | long result = 0; |
| 109 | while (n > 0) { |
| 110 | if (decoder.decode() == -1) { |
| 111 | break; |
| 112 | } |
| 113 | int limit = (int) Math.min(n, (long) decoder.buffer.remaining()); |
| 114 | decoder.discard(limit); |
| 115 | result += limit; |
| 116 | n -= limit; |
| 117 | } |
| 118 | return result; |
| 119 | } |
| 120 | } |