BeanIO 2.0.4

org.beanio.stream.json
Class JsonRecordParserFactory

java.lang.Object
  extended by org.beanio.stream.json.JsonParserConfiguration
      extended by org.beanio.stream.json.JsonRecordParserFactory
All Implemented Interfaces:
RecordParserFactory

public class JsonRecordParserFactory
extends JsonParserConfiguration
implements RecordParserFactory

A RecordParserFactory for JSON formatted streams.

Record objects are stored using a Map. A map may contain List values for a JSON array, another Map for a JSON object, or the simple types String, Number, Boolean or null.

Since:
2.0
Author:
Kevin Seim

Constructor Summary
JsonRecordParserFactory()
          Constructs a new JsonRecordParserFactory.
 
Method Summary
 RecordMarshaller createMarshaller()
          Creates a parser for marshalling records.
 RecordReader createReader(Reader in)
          Creates a parser for reading records from an input stream.
 RecordUnmarshaller createUnmarshaller()
          Creates a parser for unmarshalling records.
 RecordWriter createWriter(Writer out)
          Creates a parser for writing records to an output stream.
 void init()
          Initializes the factory.
 
Methods inherited from class org.beanio.stream.json.JsonParserConfiguration
getIndentation, getLineSeparator, isPretty, setIndentation, setLineSeparator, setPretty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonRecordParserFactory

public JsonRecordParserFactory()
Constructs a new JsonRecordParserFactory.

Method Detail

init

public void init()
          throws IllegalArgumentException
Description copied from interface: RecordParserFactory
Initializes the factory. This method is called when a mapping file is loaded after all parser properties have been set, and is therefore ideally used to preemptively validate parser configuration settings.

Specified by:
init in interface RecordParserFactory
Throws:
IllegalArgumentException - if the parser configuration is invalid

createReader

public RecordReader createReader(Reader in)
                          throws IllegalArgumentException
Description copied from interface: RecordParserFactory
Creates a parser for reading records from an input stream.

Specified by:
createReader in interface RecordParserFactory
Parameters:
in - the input stream to read from
Returns:
the created RecordReader
Throws:
IllegalArgumentException - if this factory is improperly configured and a RecordReader cannot be created

createWriter

public RecordWriter createWriter(Writer out)
                          throws IllegalArgumentException
Description copied from interface: RecordParserFactory
Creates a parser for writing records to an output stream.

Specified by:
createWriter in interface RecordParserFactory
Parameters:
out - the output stream to write to
Returns:
the new RecordWriter
Throws:
IllegalArgumentException - if this factory is improperly configured and a RecordWriter cannot be created

createMarshaller

public RecordMarshaller createMarshaller()
                                  throws IllegalArgumentException
Description copied from interface: RecordParserFactory
Creates a parser for marshalling records.

Specified by:
createMarshaller in interface RecordParserFactory
Returns:
the created RecordMarshaller
Throws:
IllegalArgumentException - if this factory is improperly configured and a RecordMarshaller cannot be created

createUnmarshaller

public RecordUnmarshaller createUnmarshaller()
                                      throws IllegalArgumentException
Description copied from interface: RecordParserFactory
Creates a parser for unmarshalling records.

Specified by:
createUnmarshaller in interface RecordParserFactory
Returns:
the created RecordUnmarshaller
Throws:
IllegalArgumentException - if this factory is improperly configured and a RecordUnmarshaller cannot be created

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim