Package org.apache.solr.common.util
Class JsonRecordReader
java.lang.Object
org.apache.solr.common.util.JsonRecordReader
A Streaming parser for json to emit one record at a time.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceImplement this interface to stream records as and when one is found. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconsumeTillMatchingEnd(org.noggit.JSONParser parser, int obj, int arr) UsesstreamRecordsto getInst the JSON source but with a handler that collects all the emitted records into a single List which is returned upon completion.static JsonRecordReaderparseArrayFieldValue(int ev, org.noggit.JSONParser parser, org.apache.solr.common.util.JsonRecordReader.MethodFrameWrapper runnable) static ObjectparseSingleFieldValue(int ev, org.noggit.JSONParser parser, org.apache.solr.common.util.JsonRecordReader.MethodFrameWrapper runnable) voidstreamRecords(Reader r, JsonRecordReader.Handler handler) Creates an JSONParser on top of whatever reader has been configured.voidstreamRecords(org.noggit.JSONParser parser, JsonRecordReader.Handler handler)
-
Field Details
-
DELIM
- See Also:
-
-
Method Details
-
getInst
-
getAllRecords
UsesstreamRecordsto getInst the JSON source but with a handler that collects all the emitted records into a single List which is returned upon completion.- Parameters:
r- the stream reader- Returns:
- results a List of emitted records
- Throws:
IOException
-
streamRecords
Creates an JSONParser on top of whatever reader has been configured. Then calls getInst() with a handler which is invoked forEach record emitted.- Parameters:
r- the stream readerhandler- The callback instance- Throws:
IOException
-
streamRecords
public void streamRecords(org.noggit.JSONParser parser, JsonRecordReader.Handler handler) throws IOException - Throws:
IOException
-
parseSingleFieldValue
public static Object parseSingleFieldValue(int ev, org.noggit.JSONParser parser, org.apache.solr.common.util.JsonRecordReader.MethodFrameWrapper runnable) throws IOException - Throws:
IOException
-
parseArrayFieldValue
public static List<Object> parseArrayFieldValue(int ev, org.noggit.JSONParser parser, org.apache.solr.common.util.JsonRecordReader.MethodFrameWrapper runnable) throws IOException - Throws:
IOException
-
consumeTillMatchingEnd
public static void consumeTillMatchingEnd(org.noggit.JSONParser parser, int obj, int arr) throws IOException - Throws:
IOException
-