@Override public void close() throws IOException { if (_state != STATE_CLOSED) { _state = STATE_CLOSED; if (_parser != null) { _parser.close(); } } }
@Override public void close() throws IOException { if (jp != null) { jp.close(); } } }
@Override public void close() throws IOException { delegate.close(); } @Override public boolean isClosed() { return delegate.isClosed(); }
@Override public void close() throws IOException { _parser.close(); } }
public void createParser() throws IOException { if ( input != null ) input.close(); input = fac.createParser(fstInput); }
@Override public void close() throws IOException { parser.close(); }
@Override public void close() throws IOException { delegate.close(); } @Override public boolean isClosed() { return delegate.isClosed(); }
@Override public void close() throws Exception { this.inputStream.close(); this.jsonParser.close(); }
public void createParser() throws IOException { if ( input != null ) input.close(); input = fac.createParser(fstInput); }
@Override public void close() throws IOException { do { delegate.close(); } while (switchToNext()); }
@Override public void close() throws IOException { clearPeek(); parser.close(); }
@Override public void rewind() throws IOException { _parser.close(); init(); }
private Document parse(JsonParser parser) throws IOException { try { return parseDocument(parser, false); } finally { parser.close(); } }
@Override public void close() throws IOException { do { delegate.close(); } while (switchToNext()); }
_state = STATE_CLOSED; if (_closeParser && (_parser != null)) { _parser.close();
private void init() throws IOException { _parser = _factory.createParser(RecordReaderUtils.getFileReader(_dataFile)); try { _iterator = JsonUtils.DEFAULT_MAPPER.readValues(_parser, Map.class); } catch (Exception e) { _parser.close(); throw e; } }
/** * Parses the {@code messages} from the reader using the given {@code schema}. */ public static <T> List<T> parseListFrom(Reader reader, Schema<T> schema, boolean numeric) throws IOException { final JsonParser parser = DEFAULT_JSON_FACTORY.createJsonParser(reader); try { return parseListFrom(parser, schema, numeric); } finally { parser.close(); } }
/** * Merges the {@code message} from the {@link Reader} using the given {@code schema}. */ public static <T> void mergeFrom(Reader reader, T message, Schema<T> schema, boolean numeric) throws IOException { final JsonParser parser = DEFAULT_JSON_FACTORY.createJsonParser(reader); try { mergeFrom(parser, message, schema, numeric); } finally { parser.close(); } }
protected static Set<String> getTopLevelJSONFields(String jsonString) throws IOException { Set<String> fields = new HashSet<>(); JsonFactory jfactory = new JsonFactory(); JsonParser jParser = jfactory.createParser(jsonString); Assert.assertNotNull(jParser); JsonToken token; jParser.nextToken(); // skip the initial START_OBJECT while ((token = jParser.nextToken()) != JsonToken.END_OBJECT) { if (token == JsonToken.START_OBJECT) { while (jParser.nextToken() != JsonToken.END_OBJECT) { } } if (token != JsonToken.FIELD_NAME) continue; fields.add(jParser.getCurrentName()); } jParser.close(); return fields; } }
/** * Helper method called for rare case of pointing to {@link JsonToken#VALUE_NULL} * token. While this is most often an erroneous condition, there is one specific * case with XML handling where polymorphic type with no properties is exposed * as such, and should be handled same as empty Object. * * @since 2.7 */ protected Object deserializeFromNull(JsonParser p, DeserializationContext ctxt) throws IOException { // 17-Dec-2015, tatu: Highly specialized case, mainly to support polymorphic // "empty" POJOs deserialized from XML, where empty XML tag synthesizes a // `VALUE_NULL` token. if (p.requiresCustomCodec()) { // not only XML module, but mostly it... @SuppressWarnings("resource") TokenBuffer tb = new TokenBuffer(p, ctxt); tb.writeEndObject(); JsonParser p2 = tb.asParser(p); p2.nextToken(); // to point to END_OBJECT // note: don't have ObjectId to consider at this point, so: Object ob = _vanillaProcessing ? vanillaDeserialize(p2, ctxt, JsonToken.END_OBJECT) : deserializeFromObject(p2, ctxt); p2.close(); return ob; } return ctxt.handleUnexpectedToken(handledType(), p); }