Class JsonRecordReader


  • public class JsonRecordReader
    extends Object
    A Streaming parser for json to emit one record at a time.
    • Method Detail

      • getAllRecords

        public List<Map<String,​Object>> getAllRecords​(Reader r)
                                                     throws IOException
        Uses streamRecords to 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

        public void streamRecords​(Reader r,
                                  JsonRecordReader.Handler handler)
                           throws IOException
        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 reader
        handler - The callback instance
        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