/** * Method for reading sequence of Objects from parser stream. * * @since 1.8 */ public <T> MappingIterator<T> readValues(JsonParser jp) throws IOException, JsonProcessingException { DeserializationContext ctxt = _createDeserializationContext(jp, _config); // false -> do not close as caller gave parser instance return new MappingIterator<T>(_valueType, jp, ctxt, _findRootDeserializer(_config, _valueType), false, _valueToUpdate); }
@Override public boolean hasNext() { try { return hasNextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
@Override public T next() { try { return nextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
/** * Method for reading sequence of Objects from parser stream. *<p> * Note that {@link ObjectReader} has more complete set of variants. * * @since 1.8 */ @Override public <T> MappingIterator<T> readValues(JsonParser jp, JavaType valueType) throws IOException, JsonProcessingException { DeserializationConfig config = copyDeserializationConfig(); DeserializationContext ctxt = _createDeserializationContext(jp, config); JsonDeserializer<?> deser = _findRootDeserializer(config, valueType); // false -> do NOT close JsonParser (since caller passed it) return new MappingIterator<T>(valueType, jp, ctxt, deser, false, null); }
public T nextValue() throws IOException { // caller should always call 'hasNext[Value]' first; but let's ensure: if (!_hasNextChecked) { if (!hasNextValue()) { throw new NoSuchElementException(); } } if (_parser == null) { throw new NoSuchElementException(); } _hasNextChecked = false; T result; if (_updatedValue == null) { result = _deserializer.deserialize(_parser, _context); } else{ _deserializer.deserialize(_parser, _context, _updatedValue); result = _updatedValue; } // Need to consume the token too _parser.clearCurrentToken(); return result; } }
@Override public T next() { try { return nextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
/** * Method for reading sequence of Objects from parser stream. * * @since 1.8 */ public <T> MappingIterator<T> readValues(String json) throws IOException, JsonProcessingException { JsonParser jp = _jsonFactory.createJsonParser(json); if (_schema != null) { jp.setSchema(_schema); } DeserializationContext ctxt = _createDeserializationContext(jp, _config); return new MappingIterator<T>(_valueType, jp, ctxt, _findRootDeserializer(_config, _valueType), true, _valueToUpdate); }
@Override public boolean hasNext() { try { return hasNextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
@Override public T next() { try { return nextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
/** * Method for reading sequence of Objects from parser stream. * * @since 1.8 */ public <T> MappingIterator<T> readValues(byte[] src, int offset, int length) throws IOException, JsonProcessingException { JsonParser jp = _jsonFactory.createJsonParser(src, offset, length); if (_schema != null) { jp.setSchema(_schema); } DeserializationContext ctxt = _createDeserializationContext(jp, _config); return new MappingIterator<T>(_valueType, jp, ctxt, _findRootDeserializer(_config, _valueType), true, _valueToUpdate); }
public T nextValue() throws IOException { // caller should always call 'hasNext[Value]' first; but let's ensure: if (!_hasNextChecked) { if (!hasNextValue()) { throw new NoSuchElementException(); } } if (_parser == null) { throw new NoSuchElementException(); } _hasNextChecked = false; T result; if (_updatedValue == null) { result = _deserializer.deserialize(_parser, _context); } else{ _deserializer.deserialize(_parser, _context, _updatedValue); result = _updatedValue; } // Need to consume the token too _parser.clearCurrentToken(); return result; } }
@Override public T next() { try { return nextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
/** * Method for reading sequence of Objects from parser stream. * * @since 1.8 */ public <T> MappingIterator<T> readValues(Reader src) throws IOException, JsonProcessingException { JsonParser jp = _jsonFactory.createJsonParser(src); if (_schema != null) { jp.setSchema(_schema); } DeserializationContext ctxt = _createDeserializationContext(jp, _config); return new MappingIterator<T>(_valueType, jp, ctxt, _findRootDeserializer(_config, _valueType), true, _valueToUpdate); }
@Override public boolean hasNext() { try { return hasNextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
@Override public T next() { try { return nextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
/** * Method for reading sequence of Objects from parser stream. * * @since 1.8 */ public <T> MappingIterator<T> readValues(File src) throws IOException, JsonProcessingException { JsonParser jp = _jsonFactory.createJsonParser(src); if (_schema != null) { jp.setSchema(_schema); } DeserializationContext ctxt = _createDeserializationContext(jp, _config); return new MappingIterator<T>(_valueType, jp, ctxt, _findRootDeserializer(_config, _valueType), true, _valueToUpdate); }