Read the next element from the JSON input stream as a string, converting escaped characters. @return String object @throws JsonException if input stream ends without finding a closing quote @throws UncheckedIOException if an I/O exception is encountered
()
| 571 | * @throws UncheckedIOException if an I/O exception is encountered |
| 572 | */ |
| 573 | private String readString() { |
| 574 | input.read(); // Skip leading quote |
| 575 | |
| 576 | StringBuilder builder = new StringBuilder(); |
| 577 | char c; |
| 578 | while (true) { |
| 579 | c = input.read(); |
| 580 | switch (c) { |
| 581 | case Input.EOF: |
| 582 | throw new JsonException("Unterminated string: " + builder + ". " + input); |
| 583 | case '"': // terminate string |
| 584 | return builder.toString(); |
| 585 | case '\\': // quoted char |
| 586 | readEscape(builder); |
| 587 | break; |
| 588 | default: |
| 589 | builder.append(c); |
| 590 | } |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | /** |
| 595 | * Convert the escape sequence at the current JSON input stream position, appending the result to |