/** * Get the next char in the string, skipping whitespace. * * @throws JSONException if the syntax of the JSON stream is not correct. * @return A character, or 0 if there are no more characters. */ public char nextClean() throws JSONException { for (;;) { char c= next(); if (c == 0 || c > ' ') { return c; } } }
if (c == '=') if (next() != '>')
/** * Consume the next character, and check that it matches a specified * character. * @param c The character to match. * @return The character. * @throws JSONException if the character does not match. */ public char next(char c) throws JSONException { char n= next(); if (n != c) { throw syntaxError("Expected '" + c + "' and instead saw '" + n + "'"); } return n; }
/** * Determine if the source string still contains characters that next() * can consume. * * @return true if not yet at the end of the source. * @throws JSONException thrown if underlying IOException is thrown. */ public boolean more() throws JSONException { char nextChar= next(); if (nextChar == 0) { return false; } back(); return true; }
/** * Get the text up but not including the specified character or the * end of line, whichever comes first. * * @param d A delimiter character. * @return A string. * @throws JSONException if the underlying JSON stream syntax is incorrect */ public String nextTo(char d) throws JSONException { StringBuilder sb= new StringBuilder(); for (;;) { char c= next(); if (c == d || c == 0 || c == '\n' || c == '\r') { if (c != 0) { back(); } return sb.toString().trim(); } sb.append(c); } }
/** * Get the text up but not including one of the specified delimiter * characters or the end of line, whichever comes first. * * @param delimiters A set of delimiter characters. * @return A string, trimmed. */ public String nextTo(String delimiters) throws JSONException { char c; StringBuilder sb= new StringBuilder(); for (;;) { c= next(); if (delimiters.indexOf(c) >= 0 || c == 0 || c == '\n' || c == '\r') { if (c != 0) { back(); } return sb.toString().trim(); } sb.append(c); } }
do c= next(); if (c == 0)