use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser in project rest.li by linkedin.
the class JacksonDataCodec method bytesToList.
@Override
public DataList bytesToList(byte[] input) throws IOException {
final Parser parser = new Parser();
JsonParser jsonParser = null;
try {
jsonParser = _jsonFactory.createParser(input);
return parser.parse(jsonParser, DataList.class);
} catch (IOException e) {
throw e;
} finally {
closeJsonParserQuietly(jsonParser);
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser in project rest.li by linkedin.
the class JacksonDataCodec method readMap.
@Override
public DataMap readMap(InputStream in) throws IOException {
final Parser parser = new Parser();
JsonParser jsonParser = null;
try {
jsonParser = _jsonFactory.createParser(in);
return parser.parse(jsonParser, DataMap.class);
} catch (IOException e) {
throw e;
} finally {
closeJsonParserQuietly(jsonParser);
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser in project rest.li by linkedin.
the class JacksonDataCodec method bytesToMap.
@Override
public DataMap bytesToMap(byte[] input) throws IOException {
final Parser parser = new Parser();
JsonParser jsonParser = null;
try {
jsonParser = _jsonFactory.createParser(input);
return parser.parse(jsonParser, DataMap.class);
} catch (IOException e) {
throw e;
} finally {
closeJsonParserQuietly(jsonParser);
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser in project immutables by immutables.
the class BsonEncoding method unwrapJsonable.
public static DBObject unwrapJsonable(String json) {
try {
JsonParser parser = JSON_FACTORY.createParser(json);
parser.nextToken();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BsonGenerator generator = BSON_FACTORY.createGenerator(outputStream);
generator.copyCurrentStructure(parser);
generator.close();
parser.close();
byte[] data = outputStream.toByteArray();
return (DBObject) new LazyDBCallback(null).createObject(data, 0);
} catch (IOException ex) {
throw Throwables.propagate(ex);
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser in project hadoop by apache.
the class StatePool method read.
private void read(DataInput in) throws IOException {
ObjectMapper mapper = new ObjectMapper();
// define a module
SimpleModule module = new SimpleModule("State Serializer", new Version(0, 1, 1, "FINAL", "", ""));
// add the state deserializer
module.addDeserializer(StatePair.class, new StateDeserializer());
// register the module with the object-mapper
mapper.registerModule(module);
JsonParser parser = mapper.getFactory().createParser((DataInputStream) in);
StatePool statePool = mapper.readValue(parser, StatePool.class);
this.setStates(statePool.getStates());
parser.close();
}
Aggregations