类com.fasterxml.jackson.core.async.NonBlockingInputFeeder源码实例Demo

下面列出了怎么用com.fasterxml.jackson.core.async.NonBlockingInputFeeder的API类实例代码及写法,或者点击链接到github查看源代码。

private static <T> StreamingDeserializer<T> newDeserializer(ObjectReader reader) {
    final JsonFactory factory = reader.getFactory();
    final JsonParser parser;
    try {
        // TODO(scott): ByteBufferFeeder is currently not supported by jackson, and the current API throws
        // UnsupportedOperationException if not supported. When jackson does support two NonBlockingInputFeeder
        // types we need an approach which doesn't involve catching UnsupportedOperationException to try to get
        // ByteBufferFeeder and then ByteArrayFeeder.
        parser = factory.createNonBlockingByteArrayParser();
    } catch (IOException e) {
        throw new IllegalArgumentException("parser initialization error for factory: " + factory, e);
    }
    NonBlockingInputFeeder rawFeeder = parser.getNonBlockingInputFeeder();
    if (rawFeeder instanceof ByteBufferFeeder) {
        return new ByteBufferJacksonDeserializer<>(reader, parser, (ByteBufferFeeder) rawFeeder);
    }
    if (rawFeeder instanceof ByteArrayFeeder) {
        return new ByteArrayJacksonDeserializer<>(reader, parser, (ByteArrayFeeder) rawFeeder);
    }
    throw new IllegalArgumentException("unsupported feeder type: " + rawFeeder);
}
 
源代码2 项目: nexus-public   文件: JsonParserDecorator.java
@Override
public NonBlockingInputFeeder getNonBlockingInputFeeder() {
  return jsonParser.getNonBlockingInputFeeder();
}
 
源代码3 项目: lams   文件: JsonParser.java
/**
 * Method that will either return a feeder instance (if parser uses
 * non-blocking, aka asynchronous access); or <code>null</code> for
 * parsers that use blocking I/O.
 *
 * @since 2.9
 */
public NonBlockingInputFeeder getNonBlockingInputFeeder() {
    return null;
}
 
 同包方法