BeanIO 2.0.4

org.beanio.stream.json
Class JsonReader

java.lang.Object
  extended by org.beanio.stream.json.JsonReaderSupport
      extended by org.beanio.stream.json.JsonReader
All Implemented Interfaces:
RecordReader

public class JsonReader
extends JsonReaderSupport
implements RecordReader

A RecordReader implementation for JSON formatted records.

Since:
2.0
Author:
Kevin Seim
See Also:
JsonRecordParserFactory

Field Summary
 
Fields inherited from class org.beanio.stream.json.JsonReaderSupport
eof, in
 
Constructor Summary
JsonReader(Reader in)
          Constructs a new JsonReader.
 
Method Summary
 void close()
          Closes this input stream.
 int getRecordLineNumber()
          Returns the line number of the last record from this input stream.
 String getRecordText()
          Returns the unparsed record text of the last record read.
static void main(String[] args)
           
 Map<String,Object> read()
          Reads a single record from this input stream.
 
Methods inherited from class org.beanio.stream.json.JsonReaderSupport
isWhitespace, parseValue, readArray, readObject, readString, readUnicode, setReader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonReader

public JsonReader(Reader in)
Constructs a new JsonReader.

Parameters:
in - the Reader to read from
Method Detail

read

public Map<String,Object> read()
                        throws IOException,
                               RecordIOException
Description copied from interface: RecordReader
Reads a single record from this input stream. The type of object returned depends on the format of the stream.

Specified by:
read in interface RecordReader
Returns:
the record value, or null if the end of the stream was reached.
Throws:
IOException - if an I/O error occurs reading from the stream
RecordIOException - if the record is malformed and cannot be parsed, but subsequent reads may still be possible

close

public void close()
           throws IOException
Description copied from interface: RecordReader
Closes this input stream.

Specified by:
close in interface RecordReader
Throws:
IOException - if an I/O error occurs closing the stream

getRecordLineNumber

public int getRecordLineNumber()
Description copied from interface: RecordReader
Returns the line number of the last record from this input stream. If a record spans multiple lines, the line number at the beginning of the record is returned. May return -1 if the end of the stream was reached, or 0 if new lines are not used to terminate records.

Specified by:
getRecordLineNumber in interface RecordReader
Returns:
the beginning line number of the last record read

getRecordText

public String getRecordText()
Description copied from interface: RecordReader
Returns the unparsed record text of the last record read.

Specified by:
getRecordText in interface RecordReader
Returns:
the unparsed text of the last record read

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim