@Override public void close() throws IOException { delegate.close(); }
@Override public void close() throws IOException { jsonParser.close(); }
@Override public void close() throws IOException { jsonParser.close(); }
@Override public void close() throws IOException { do { delegate.close(); } while (switchToNext()); }
@Override public void close() { try { parser.close(); } catch (IOException ex) { throw new EsHadoopSerializationException(ex); } }
protected Object _convert(Object fromValue, JavaType toValueType) throws IllegalArgumentException { // sanity check for null first: if (fromValue == null) return null; /* Then use TokenBuffer, which is a JsonGenerator: * (see [JACKSON-175]) */ TokenBuffer buf = new TokenBuffer(this); try { writeValue(buf, fromValue); // and provide as with a JsonParser for contents as well! JsonParser jp = buf.asParser(); Object result = readValue(jp, toValueType); jp.close(); return result; } catch (IOException e) { // should not occur, no real i/o... throw new IllegalArgumentException(e.getMessage(), e); } }
private Schema parse(JsonParser parser) throws IOException { boolean saved = validateNames.get(); boolean savedValidateDefaults = VALIDATE_DEFAULTS.get(); try { validateNames.set(validate); VALIDATE_DEFAULTS.set(validateDefaults); return Schema.parse(MAPPER.readTree(parser), names); } catch (JsonParseException e) { throw new SchemaParseException(e); } finally { parser.close(); validateNames.set(saved); VALIDATE_DEFAULTS.set(savedValidateDefaults); } } }
protected JsonNode _bindAndCloseAsTree(JsonParser jp) throws IOException, JsonParseException, JsonMappingException { if (_schema != null) { jp.setSchema(_schema); } try { return _bindAsTree(jp); } finally { try { jp.close(); } catch (IOException ioe) { } } }
JsonParser jp = buf.asParser(); result = readTree(jp); jp.close(); } catch (IOException e) { // should not occur, no real i/o... throw new IllegalArgumentException(e.getMessage(), e);
/** * Equivalent of {@link #next} but one that may throw checked * exceptions from Jackson due to invalid input. */ public boolean hasNextValue() throws IOException { if (_parser == null) { return false; } JsonToken t = _parser.getCurrentToken(); if (t == null) { // un-initialized or cleared; find next t = _parser.nextToken(); // If EOF, no more if (t == null) { _parser.close(); return false; } // And similarly if we hit END_ARRAY; except that we won't close parser if (t == JsonToken.END_ARRAY) { return false; } } return true; }
_parser = null; if (_closeParser) { jp.close();
@Override public void close() throws IOException { delegate.close(); }
@Override public void close() throws IOException { parser.close(); }
public void close() throws IOException { parser.close(); }
} finally { try { jp.close(); } catch (IOException ioe) { }
} finally { try { jp.close(); } catch (IOException ioe) { }
@Override public void close() throws IOException { do { delegate.close(); } while (switchToNext()); }
protected Object _convert(Object fromValue, JavaType toValueType) throws IllegalArgumentException { // sanity check for null first: if (fromValue == null) return null; /* Then use TokenBuffer, which is a JsonGenerator: * (see [JACKSON-175]) */ TokenBuffer buf = new TokenBuffer(this); try { writeValue(buf, fromValue); // and provide as with a JsonParser for contents as well! JsonParser jp = buf.asParser(); Object result = readValue(jp, toValueType); jp.close(); return result; } catch (IOException e) { // should not occur, no real i/o... throw new IllegalArgumentException(e.getMessage(), e); } }
protected JsonNode _bindAndCloseAsTree(JsonParser jp) throws IOException, JsonParseException, JsonMappingException { if (_schema != null) { jp.setSchema(_schema); } try { return _bindAsTree(jp); } finally { try { jp.close(); } catch (IOException ioe) { } } }