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

The following examples show how to use com.fasterxml.jackson.core.async.ByteArrayFeeder. 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: Jackson2Tokenizer.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private Jackson2Tokenizer(
		JsonParser parser, DeserializationContext deserializationContext, boolean tokenizeArrayElements) {

	this.parser = parser;
	this.deserializationContext = deserializationContext;
	this.tokenizeArrayElements = tokenizeArrayElements;
	this.tokenBuffer = new TokenBuffer(parser, deserializationContext);
	this.inputFeeder = (ByteArrayFeeder) this.parser.getNonBlockingInputFeeder();
}
 
Example #3
Source File: Jackson2Tokenizer.java    From java-technology-stack with MIT License 5 votes vote down vote up
private Jackson2Tokenizer(JsonParser parser, boolean tokenizeArrayElements) {
	Assert.notNull(parser, "'parser' must not be null");

	this.parser = parser;
	this.tokenizeArrayElements = tokenizeArrayElements;
	this.tokenBuffer = new TokenBuffer(parser);
	this.inputFeeder = (ByteArrayFeeder) this.parser.getNonBlockingInputFeeder();
}
 
Example #4
Source File: ByteArrayJacksonDeserializer.java    From servicetalk with Apache License 2.0 4 votes vote down vote up
ByteArrayJacksonDeserializer(ObjectReader reader, JsonParser parser, ByteArrayFeeder feeder) {
    super(reader, parser);
    this.feeder = feeder;
}
 
Example #5
Source File: NonBlockingJsonParser.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ByteArrayFeeder getNonBlockingInputFeeder() {
    return this;
}