Example #1
0
 public void close() {
   try {
     tokenizer.close();
   } catch (IOException e) {
     throw new JsonException(e);
   }
 }
Example #2
0
 public JsonNumber.NumberType getNumberType() {
   if (currentEvent != Event.VALUE_NUMBER) {
     throw new IllegalStateException(
         "JsonParser#getNumberType() is valid only "
             + "VALUE_NUMBER parser state. "
             + "But current parser state is "
             + currentEvent);
   }
   BigDecimal bigDecimal = new BigDecimal(tokenizer.getValue());
   return bigDecimal.scale() == 0 ? JsonNumber.NumberType.INTEGER : JsonNumber.NumberType.DECIMAL;
 }
Example #3
0
 @Override
 public BigDecimal getBigDecimalValue() {
   if (currentEvent != Event.VALUE_NUMBER) {
     throw new IllegalStateException(
         "JsonParser#getNumberType() is valid only "
             + "VALUE_NUMBER parser state. "
             + "But current parser state is "
             + currentEvent);
   }
   return new BigDecimal(tokenizer.getValue());
 }
Example #4
0
 public String getString() {
   if (currentEvent == Event.KEY_NAME
       || currentEvent == Event.VALUE_STRING
       || currentEvent == Event.VALUE_NUMBER) {
     return tokenizer.getValue();
   }
   throw new IllegalStateException(
       "JsonParser#getString() is valid only "
           + "KEY_NAME, VALUE_STRING, VALUE_NUMBER parser states. "
           + "But current parser state is "
           + currentEvent);
 }