Recycle the input buffer.
()
| 178 | * Recycle the input buffer. |
| 179 | */ |
| 180 | public void recycle() { |
| 181 | |
| 182 | state = INITIAL_STATE; |
| 183 | |
| 184 | // If usage of mark made the buffer too big, reallocate it |
| 185 | if (cb.capacity() > size) { |
| 186 | cb = CharBuffer.allocate(size); |
| 187 | clear(cb); |
| 188 | } else { |
| 189 | clear(cb); |
| 190 | } |
| 191 | readLimit = size; |
| 192 | markPos = -1; |
| 193 | /* |
| 194 | * This buffer will have been replaced if there was data to read so re-initialise to an empty buffer to clear |
| 195 | * any reference to an injected buffer. |
| 196 | */ |
| 197 | bb = EMPTY_BUFFER; |
| 198 | closed = false; |
| 199 | |
| 200 | if (conv != null) { |
| 201 | conv.recycle(); |
| 202 | encoders.get(conv.getCharset()).push(conv); |
| 203 | conv = null; |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | |
| 208 | @Override |