public DataFormatReaders withMinimalMatch(MatchStrength minMatch) { if (minMatch == _minimalMatch) { return this; } return new DataFormatReaders(_readers, _optimalMatch, minMatch, _maxInputLookahead); }
/** * Method to call to find format that given content (full document) * has, as per configuration of this detector instance. * * @return Matcher object which contains result; never null, even in cases * where no match (with specified minimal match strength) is found. */ public Match findFormat(byte[] fullInputData) throws IOException { return _findFormat(new AccessorForReader(fullInputData)); }
/** * Overloaded version of {@link #readValue(InputStream)}. */ public <T> MappingIterator<T> readValues(byte[] src, int offset, int length) throws IOException { if (_dataFormatReaders != null) { return _detectBindAndReadValues(_dataFormatReaders.findFormat(src, offset, length), false); } return _bindAndReadValues(_considerFilter(_parserFactory.createParser(src, offset, length), true)); }
protected ObjectReader _with(DeserializationConfig newConfig) { if (newConfig == _config) { return this; } ObjectReader r = _new(this, newConfig); if (_dataFormatReaders != null) { r = r.withFormatDetection(_dataFormatReaders.with(newConfig)); } return r; }
/** * Method called to indicate that format detection failed to detect format * of given input */ protected void _reportUnkownFormat(DataFormatReaders detector, DataFormatReaders.Match match) throws JsonProcessingException { // 17-Aug-2015, tatu: Unfortunately, no parser/generator available so: throw new JsonParseException(null, "Cannot detect format from input, does not look like any of detectable formats " +detector.toString()); }
/** * Method for constructing a new reader instance that is configured * to data bind into specified type. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. * * @since 2.5 */ public ObjectReader forType(JavaType valueType) { if (valueType != null && valueType.equals(_valueType)) { return this; } JsonDeserializer<Object> rootDeser = _prefetchRootDeserializer(valueType); // type is stored here, no need to make a copy of config DataFormatReaders det = _dataFormatReaders; if (det != null) { det = det.withType(valueType); } return _new(this, _config, valueType, rootDeser, _valueToUpdate, _schema, _injectableValues, det); }
protected ObjectReader _with(DeserializationConfig newConfig) { if (newConfig == _config) { return this; } ObjectReader r = _new(this, newConfig); if (_dataFormatReaders != null) { r = r.withFormatDetection(_dataFormatReaders.with(newConfig)); } return r; }
/** * Method called to indicate that format detection failed to detect format * of given input */ protected void _reportUnkownFormat(DataFormatReaders detector, DataFormatReaders.Match match) throws JsonProcessingException { throw new JsonParseException("Can not detect format from input, does not look like any of detectable formats " +detector.toString(), JsonLocation.NA); }
/** * Method for constructing a new reader instance that is configured * to data bind into specified type. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectReader withType(JavaType valueType) { if (valueType != null && valueType.equals(_valueType)) { return this; } JsonDeserializer<Object> rootDeser = _prefetchRootDeserializer(_config, valueType); // type is stored here, no need to make a copy of config DataFormatReaders det = _dataFormatReaders; if (det != null) { det = det.withType(valueType); } return new ObjectReader(this, _config, valueType, rootDeser, _valueToUpdate, _schema, _injectableValues, det); }
public DataFormatReaders withOptimalMatch(MatchStrength optMatch) { if (optMatch == _optimalMatch) { return this; } return new DataFormatReaders(_readers, optMatch, _minimalMatch, _maxInputLookahead); }
/** * Method that binds content read from given input source, * using configuration of this reader. * Value return is either newly constructed, or root value that * was specified with {@link #withValueToUpdate(Object)}. */ @SuppressWarnings("unchecked") public <T> T readValue(InputStream src) throws IOException { if (_dataFormatReaders != null) { return (T) _detectBindAndClose(_dataFormatReaders.findFormat(src), false); } return (T) _bindAndClose(_considerFilter(_parserFactory.createParser(src), false)); }
/** * Method to call to find format that content (accessible via given * {@link InputStream}) given has, as per configuration of this detector * instance. * * @return Matcher object which contains result; never null, even in cases * where no match (with specified minimal match strength) is found. */ public Match findFormat(InputStream in) throws IOException { return _findFormat(new AccessorForReader(in, new byte[_maxInputLookahead])); }
protected ObjectReader _with(DeserializationConfig newConfig) { if (newConfig == _config) { return this; } ObjectReader r = _new(this, newConfig); if (_dataFormatReaders != null) { r = r.withFormatDetection(_dataFormatReaders.with(newConfig)); } return r; }
/** * Method called to indicate that format detection failed to detect format * of given input */ protected void _reportUnkownFormat(DataFormatReaders detector, DataFormatReaders.Match match) throws JsonProcessingException { // 17-Aug-2015, tatu: Unfortunately, no parser/generator available so: throw new JsonParseException(null, "Can not detect format from input, does not look like any of detectable formats " +detector.toString()); }
/** * Method for constructing a new reader instance that is configured * to data bind into specified type. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. * * @since 2.5 */ public ObjectReader forType(JavaType valueType) { if (valueType != null && valueType.equals(_valueType)) { return this; } JsonDeserializer<Object> rootDeser = _prefetchRootDeserializer(valueType); // type is stored here, no need to make a copy of config DataFormatReaders det = _dataFormatReaders; if (det != null) { det = det.withType(valueType); } return _new(this, _config, valueType, rootDeser, _valueToUpdate, _schema, _injectableValues, det); }
public DataFormatReaders withMaxInputLookahead(int lookaheadBytes) { if (lookaheadBytes == _maxInputLookahead) { return this; } return new DataFormatReaders(_readers, _optimalMatch, _minimalMatch, lookaheadBytes); }
@SuppressWarnings("unchecked") public <T> T readValue(File src) throws IOException { if (_dataFormatReaders != null) { return (T) _detectBindAndClose(_dataFormatReaders.findFormat(_inputStream(src)), true); } return (T) _bindAndClose(_considerFilter(_parserFactory.createParser(src), false)); }
/** * Method to call to find format that given content (full document) * has, as per configuration of this detector instance. * * @return Matcher object which contains result; never null, even in cases * where no match (with specified minimal match strength) is found. * * @since 2.1 */ public Match findFormat(byte[] fullInputData, int offset, int len) throws IOException { return _findFormat(new AccessorForReader(fullInputData, offset, len)); }
protected ObjectReader _with(DeserializationConfig newConfig) { if (newConfig == _config) { return this; } ObjectReader r = _new(this, newConfig); if (_dataFormatReaders != null) { r = r.withFormatDetection(_dataFormatReaders.with(newConfig)); } return r; }
/** * Method called to indicate that format detection failed to detect format * of given input */ protected void _reportUnkownFormat(DataFormatReaders detector, DataFormatReaders.Match match) throws JsonProcessingException { throw new JsonParseException("Can not detect format from input, does not look like any of detectable formats " +detector.toString(), JsonLocation.NA); }