All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.pgelinas.jackson.javax.json.JacksonReaderFactory Maven / Gradle / Ivy

Go to download

An alternate implementation of JSR-353 based on Jackson, which aims to bring better performance and configurability.

There is a newer version: 1.0.0
Show newest version
package com.github.pgelinas.jackson.javax.json;

import java.io.*;
import java.nio.charset.*;
import java.util.*;

import javax.json.*;

import com.fasterxml.jackson.databind.*;

public class JacksonReaderFactory implements JsonReaderFactory {
    private final ObjectMapper _mapper;
    private final NodeFactory _nodeFactory;

    public JacksonReaderFactory(Map config) {
        _mapper = new ObjectMapper();
        _nodeFactory = new NodeFactory();
    }

    public JacksonReaderFactory(ObjectMapper mapper, NodeFactory nodeFactory) {
        _mapper = mapper;
        _nodeFactory = nodeFactory;
    }

    @Override
    public JsonReader createReader(Reader reader) {
        return new JacksonReader(_mapper, _nodeFactory, reader);
    }

    @Override
    public JsonReader createReader(InputStream in) {
        return new JacksonReader(_mapper, _nodeFactory, in);
    }

    @Override
    public JsonReader createReader(InputStream in, Charset charset) {
        return createReader(new InputStreamReader(in, charset));
    }

    @Override
    public Map getConfigInUse() {
        return Collections.emptyMap();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy