int first = nextCleanInternal(); if (first == '}') { return result; int separator = nextCleanInternal(); if (separator != ':' && separator != '=') { throw syntaxError("Expected a ':' after a key"); switch (nextCleanInternal()) { case '}': return result;
int first = nextCleanInternal(); if (first == '}') { return result; int separator = nextCleanInternal(); if (separator != ':' && separator != '=') { throw syntaxError("Expected a ':' after a key"); switch (nextCleanInternal()) { case '}': return result;
switch (nextCleanInternal()) { case -1: throw syntaxError("Expected a ',' or ']'"); switch (nextCleanInternal()) { case ']': return result;
switch (nextCleanInternal()) { case -1: throw syntaxError("Expected a ',' or ']'"); switch (nextCleanInternal()) { case ']': return result;
/** * Returns the next value from the input. * * @return a {@link JSONObject}, {@link JSONArray}, String, Boolean, * Integer, Long, Double or {@link JSONObject#NULL}. * @throws RuntimeException if the input is malformed. */ Object nextValue(Class<?> desiredType) { int c = nextCleanInternal(); if (JSONObject.class.equals(desiredType) && c != '{'){ throw syntaxError("A JSONObject text must begin with '{'"); } if (JSONArray.class.equals(desiredType) && c != '['){ throw syntaxError("A JSONArray text must start with '['"); } switch (c) { case -1: throw syntaxError("End of input"); case '{': return readObject(); case '[': return readArray(); case '\'': case '"': return nextString((char) c); default: pos--; return readLiteral(); } }
/** * Returns the next value from the input. * * @return a {@link JSONObject}, {@link JSONArray}, String, Boolean, * Integer, Long, Double or {@link JSONObject#NULL}. * @throws RuntimeException if the input is malformed. */ Object nextValue(Class<?> desiredType) { int c = nextCleanInternal(); if (JSONObject.class.equals(desiredType) && c != '{'){ throw syntaxError("A JSONObject text must begin with '{'"); } if (JSONArray.class.equals(desiredType) && c != '['){ throw syntaxError("A JSONArray text must start with '['"); } switch (c) { case -1: throw syntaxError("End of input"); case '{': return readObject(); case '[': return readArray(); case '\'': case '"': return nextString((char) c); default: pos--; return readLiteral(); } }