private void readRequiredChar(char ch) throws IOException { if (!readChar(ch)) { throw expected("'" + ch + "'"); } }
private boolean readFraction() throws IOException { if (!readChar('.')) { return false; } if (!readDigit()) { throw expected("digit"); } while (readDigit()) { } return true; }
private void readArray() throws IOException { Object array = handler.startArray(); read(); if (++nestingLevel > MAX_NESTING_LEVEL) { throw error("Nesting too deep"); } skipWhiteSpace(); if (readChar(']')) { nestingLevel--; handler.endArray(array); return; } do { skipWhiteSpace(); handler.startArrayValue(array); readValue(); handler.endArrayValue(array); skipWhiteSpace(); } while (readChar(',')); if (!readChar(']')) { throw expected("',' or ']'"); } nestingLevel--; handler.endArray(array); }
private void readNumber() throws IOException { handler.startNumber(); startCapture(); readChar('-'); int firstDigit = current; if (!readDigit()) { throw expected("digit"); } if (firstDigit != '0') { while (readDigit()) { } } readFraction(); readExponent(); handler.endNumber(endCapture()); }
private void readRequiredChar(char ch) throws IOException { if (!readChar(ch)) { throw expected("'" + ch + "'"); } }
private void readRequiredChar(char ch) throws IOException { if (!readChar(ch)) { throw expected("'" + ch + "'"); } }
private void readRequiredChar( char ch ) throws IOException { if( !readChar( ch ) ) { throw expected( "'" + ch + "'" ); } }
private boolean readFraction() throws IOException { if (!readChar('.')) { return false; } if (!readDigit()) { throw expected("digit"); } while (readDigit()) { } return true; }
private boolean readFraction() throws IOException { if (!readChar('.')) { return false; } if (!readDigit()) { throw expected("digit"); } while (readDigit()) { } return true; }
private boolean readFraction() throws IOException { if( !readChar( '.' ) ) { return false; } if( !readDigit() ) { throw expected( "digit" ); } while( readDigit() ) { } return true; }
private JsonArray readArray() throws IOException { read(); JsonArray array = new JsonArray(); skipWhiteSpace(); if( readChar( ']' ) ) { return array; } do { skipWhiteSpace(); array.add( readValue() ); skipWhiteSpace(); } while( readChar( ',' ) ); if( !readChar( ']' ) ) { throw expected( "',' or ']'" ); } return array; }
private JsonObject readObject() throws IOException { read(); JsonObject object = new JsonObject(); skipWhiteSpace(); if( readChar( '}' ) ) { return object; } do { skipWhiteSpace(); String name = readName(); skipWhiteSpace(); if( !readChar( ':' ) ) { throw expected( "':'" ); } skipWhiteSpace(); object.add( name, readValue() ); skipWhiteSpace(); } while( readChar( ',' ) ); if( !readChar( '}' ) ) { throw expected( "',' or '}'" ); } return object; }
private JsonValue readNumber() throws IOException { startCapture(); readChar( '-' ); int firstDigit = current; if( !readDigit() ) { throw expected( "digit" ); } if( firstDigit != '0' ) { while( readDigit() ) { } } readFraction(); readExponent(); return new JsonNumber( endCapture() ); }
private void readNumber() throws IOException { handler.startNumber(); startCapture(); readChar('-'); int firstDigit = current; if (!readDigit()) { throw expected("digit"); } if (firstDigit != '0') { while (readDigit()) { } } readFraction(); readExponent(); handler.endNumber(endCapture()); }
private void readNumber() throws IOException { handler.startNumber(); startCapture(); readChar('-'); int firstDigit = current; if (!readDigit()) { throw expected("digit"); } if (firstDigit != '0') { while (readDigit()) { } } readFraction(); readExponent(); handler.endNumber(endCapture()); }