Package org.beanio.stream.json
Class JsonReader
- java.lang.Object
-
- org.beanio.stream.json.JsonReaderSupport
-
- org.beanio.stream.json.JsonReader
-
- All Implemented Interfaces:
RecordReader
public class JsonReader extends JsonReaderSupport implements RecordReader
ARecordReader
implementation for JSON formatted records.- Since:
- 2.0
- See Also:
JsonRecordParserFactory
-
-
Field Summary
-
Fields inherited from class org.beanio.stream.json.JsonReaderSupport
eof, in
-
-
Constructor Summary
Constructors Constructor Description JsonReader(java.io.Reader in)
Constructs a newJsonReader
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this input stream.int
getRecordLineNumber()
Returns the line number of the last record from this input stream.java.lang.String
getRecordText()
Returns the unparsed record text of the last record read.static void
main(java.lang.String[] args)
java.util.Map<java.lang.String,java.lang.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
-
-
-
-
Method Detail
-
read
public java.util.Map<java.lang.String,java.lang.Object> read() throws java.io.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 interfaceRecordReader
- Returns:
- the record value, or null if the end of the stream was reached.
- Throws:
java.io.IOException
- if an I/O error occurs reading from the streamRecordIOException
- if the record is malformed and cannot be parsed, but subsequent reads may still be possible
-
close
public void close() throws java.io.IOException
Description copied from interface:RecordReader
Closes this input stream.- Specified by:
close
in interfaceRecordReader
- Throws:
java.io.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 interfaceRecordReader
- Returns:
- the beginning line number of the last record read
-
getRecordText
public java.lang.String getRecordText()
Description copied from interface:RecordReader
Returns the unparsed record text of the last record read.- Specified by:
getRecordText
in interfaceRecordReader
- Returns:
- the unparsed text of the last record read
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-