private JsonToken readingConstant ( JsonTokenType type , JsonToken token ) { try { int numCharsToRead = ( ( String ) type . getValidator ( ) ) . length ( ) ; char [ ] chars = new char [ numCharsToRead ] ; reader . read ( chars ) ; String stringRead = new String ( chars ) ; if ( stringRead . equals ( type . getValidator ( ) ) ) { token . setEndColumn ( token . getStartColumn ( ) + numCharsToRead ) ; token . setText ( stringRead ) ; return token ; } else { throwJsonException ( stringRead , type ) ; } } catch ( IOException ioe ) { throw new JsonException ( "An IO exception occurred while reading the JSON payload" , ioe ) ; } return null ; }
When a constant token type is expected check that the expected constant is read and update the content of the token accordingly .