com.fasterxml.jackson.core.async.NonBlockingInputFeeder Java Examples

The following examples show how to use com.fasterxml.jackson.core.async.NonBlockingInputFeeder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JacksonSerializationProvider.java    From servicetalk with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #2
Source File: JsonParserDecorator.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public NonBlockingInputFeeder getNonBlockingInputFeeder() {
  return jsonParser.getNonBlockingInputFeeder();
}
 
Example #3
Source File: JsonParser.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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;
}