BeanIO 2.0.4

org.beanio.stream.json
Class JsonReaderSupport

java.lang.Object
  extended by org.beanio.stream.json.JsonReaderSupport
Direct Known Subclasses:
JsonReader, JsonRecordUnmarshaller

public abstract class JsonReaderSupport
extends Object

Base class for reading a JSON formatted stream.

Since:
2.0
Author:
Kevin Seim
See Also:
JsonRecordParserFactory

Field Summary
protected  boolean eof
          Flag indicating the end of the stream was reached
protected  Reader in
          The Reader to read from
 
Method Summary
protected  boolean isWhitespace(char c)
          Returns whether the given character is whitespace.
protected  Object parseValue(String text)
          Parses a null, boolean or numeric value from the given text.
protected  List<Object> readArray()
          Reads a JSON array from the input stream.
protected  Map<String,Object> readObject()
          Reads the next JSON object from the stream.
protected  String readString()
          Reads a JSON string value from the input stream.
protected  char readUnicode()
          Reads a Unicode character in JSON format.
protected  void setReader(Reader in)
          Set the Reader to read from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

protected Reader in
The Reader to read from


eof

protected boolean eof
Flag indicating the end of the stream was reached

Method Detail

setReader

protected void setReader(Reader in)
Set the Reader to read from.

Parameters:
in - the Reader

readObject

protected Map<String,Object> readObject()
                                 throws IOException
Reads the next JSON object from the stream.

Returns:
the JSON object Map
Throws:
IOException

readArray

protected List<Object> readArray()
                          throws IOException
Reads a JSON array from the input stream.

Returns:
the parsed JSON array
Throws:
IOException

parseValue

protected Object parseValue(String text)
                     throws IOException
Parses a null, boolean or numeric value from the given text.

Parameters:
text - the text to parse
Returns:
the parsed value: either null, Boolean, Double, Long or Integer
Throws:
IOException

readString

protected String readString()
                     throws IOException
Reads a JSON string value from the input stream.

Returns:
the JSON string value
Throws:
IOException

readUnicode

protected char readUnicode()
                    throws IOException
Reads a Unicode character in JSON format.

Returns:
the Unicode character
Throws:
IOException

isWhitespace

protected boolean isWhitespace(char c)
Returns whether the given character is whitespace.

Parameters:
c - the character to test
Returns:
true if whitespace, false othereise

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim