Returns the next token, a {@link JsonToken#NAME property name}, and consumes it. @throws IllegalStateException if the next token is not a property name.
()
| 923 | * @throws IllegalStateException if the next token is not a property name. |
| 924 | */ |
| 925 | public String nextName() throws IOException { |
| 926 | int p = peeked; |
| 927 | if (p == PEEKED_NONE) { |
| 928 | p = doPeek(); |
| 929 | } |
| 930 | String result; |
| 931 | if (p == PEEKED_UNQUOTED_NAME) { |
| 932 | result = nextUnquotedValue(); |
| 933 | } else if (p == PEEKED_SINGLE_QUOTED_NAME) { |
| 934 | result = nextQuotedValue('\''); |
| 935 | } else if (p == PEEKED_DOUBLE_QUOTED_NAME) { |
| 936 | result = nextQuotedValue('"'); |
| 937 | } else { |
| 938 | throw unexpectedTokenError("a name"); |
| 939 | } |
| 940 | peeked = PEEKED_NONE; |
| 941 | pathNames[stackSize - 1] = result; |
| 942 | return result; |
| 943 | } |
| 944 | |
| 945 | /** |
| 946 | * Returns the {@link JsonToken#STRING string} value of the next token, consuming it. If the next |