MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / parseToStream

Method parseToStream

src/utils/JSON.java:210–220  ·  view source on GitHub ↗

Parses a JSON formatted string into raw tokens for streaming or tree iteration Warning: This method can parse an invalid JSON object without throwing an error until you start processing the data @param json The string to parse @return A JsonParser object to be used for iteration @throws Illeg

(final String json)

Source from the content-addressed store, hash-verified

208 * @throws JSONException if the data could not be parsed
209 */
210 public static final JsonParser parseToStream(final String json) {
211 if (json == null || json.isEmpty())
212 throw new IllegalArgumentException("Incoming data was null or empty");
213 try {
214 return jsonMapper.getFactory().createJsonParser(json);
215 } catch (JsonParseException e) {
216 throw new IllegalArgumentException(e);
217 } catch (IOException e) {
218 throw new JSONException(e);
219 }
220 }
221
222 /**
223 * Parses a JSON formatted byte array into raw tokens for streaming or tree

Callers 10

parseToStreamUTFSByteMethod · 0.95
parseToStreamByteNullMethod · 0.95
parseToMapMethod · 0.95

Calls 2

isEmptyMethod · 0.80
getFactoryMethod · 0.80

Tested by 10

parseToStreamUTFSByteMethod · 0.76
parseToStreamByteNullMethod · 0.76
parseToMapMethod · 0.76