com.github.pgelinas.jackson.javax.json.JacksonReaderFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jackson-javax-json Show documentation
Show all versions of jackson-javax-json Show documentation
An alternate implementation of JSR-353 based on Jackson, which aims to bring better performance and configurability.
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