Return a string containing the most recently consumed input characters. @return String with up to 128 consumed input characters
()
| 230 | * @return {@link String} with up to 128 consumed input characters |
| 231 | */ |
| 232 | @Override |
| 233 | public String toString() { |
| 234 | int offset; |
| 235 | int length; |
| 236 | |
| 237 | if (position < MEMORY_SIZE) { |
| 238 | offset = 0; |
| 239 | length = position + 1; |
| 240 | } else { |
| 241 | offset = position + 1 - MEMORY_SIZE; |
| 242 | length = MEMORY_SIZE; |
| 243 | } |
| 244 | |
| 245 | String last = "Last " + length + " characters read: " + new String(buffer, offset, length); |
| 246 | int next = Math.min(MEMORY_SIZE, filled - (offset + length)); |
| 247 | |
| 248 | if (next > 0) { |
| 249 | if (next > 128) { |
| 250 | next = 128; |
| 251 | } |
| 252 | return last |
| 253 | + ", next " |
| 254 | + next |
| 255 | + " characters to read: " |
| 256 | + new String(buffer, offset + length, next); |
| 257 | } |
| 258 | |
| 259 | return last; |
| 260 | } |
| 261 | |
| 262 | /** |
| 263 | * If all buffered input has been consumed, read the next chunk into the buffer.<br> |
nothing calls this directly
no outgoing calls
no test coverage detected