Package org.apache.solr.common.util

# Class JsonRecordReader

java.lang.Object
org.apache.solr.common.util.JsonRecordReader

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

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`JsonRecordReader.Handler`
Implement this interface to stream records as and when one is found.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`DELIM`

## Method Summary

Modifier and Type
Method
Description
`static void`
`consumeTillMatchingEnd(org.noggit.JSONParser parser, int obj, int arr)`
`List<Map<String,Object>>`
`getAllRecords(Reader r)`
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.
`static JsonRecordReader`
`getInst(String split, List<String> fieldMappings)`
`static List<Object>`
`parseArrayFieldValue(int ev, org.noggit.JSONParser parser, org.apache.solr.common.util.JsonRecordReader.MethodFrameWrapper runnable)`
`static Object`
`parseSingleFieldValue(int ev, org.noggit.JSONParser parser, org.apache.solr.common.util.JsonRecordReader.MethodFrameWrapper runnable)`
`void`
`streamRecords(Reader r, JsonRecordReader.Handler handler)`
Creates an JSONParser on top of whatever reader has been configured.
`void`
`streamRecords(org.noggit.JSONParser parser, JsonRecordReader.Handler handler)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DELIM

public static final String DELIM

See Also:
  - Constant Field Values

## Method Details

### getInst

public static JsonRecordReader getInst(String split, List<String> fieldMappings)

### 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`

### 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`