use of com.fasterxml.jackson.core.JsonParser in project rest.li by linkedin.
the class JacksonDataCodec method stringToMap.
@Override
public DataMap stringToMap(String 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 com.fasterxml.jackson.core.JsonParser in project rest.li by linkedin.
the class JacksonDataCodec method parse.
/**
* Reads an {@link InputStream} and parses its contents into a list of Data objects.
*
* @param in provides the {@link InputStream}
* @param mesg provides the {@link StringBuilder} to store validation error messages,
* such as duplicate keys in the same {@link DataMap}.
* @param locationMap provides where to store the mapping of a Data object
* to its location in the in the {@link InputStream}. may be
* {@code null} if this mapping is not needed by the caller.
* This map should usually be an {@link IdentityHashMap}.
* @return the list of Data objects parsed from the {@link InputStream}.
* @throws IOException if there is a syntax error in the input.
*/
public List<Object> parse(InputStream in, StringBuilder mesg, Map<Object, DataLocation> locationMap) throws IOException {
final Parser parser = new Parser(true);
JsonParser jsonParser = null;
try {
jsonParser = _jsonFactory.createParser(in);
return parser.parse(jsonParser, mesg, locationMap);
} catch (IOException e) {
throw e;
} finally {
closeJsonParserQuietly(jsonParser);
}
}
use of 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 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 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);
}
}
Aggregations