Package org.beanio.stream.json
Class JsonReaderSupport
- java.lang.Object
-
- org.beanio.stream.json.JsonReaderSupport
-
- Direct Known Subclasses:
JsonReader
,JsonRecordUnmarshaller
public abstract class JsonReaderSupport extends java.lang.Object
Base class for reading a JSON formatted stream.- Since:
- 2.0
- See Also:
JsonRecordParserFactory
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
isWhitespace(char c)
Returns whether the given character is whitespace.protected java.lang.Object
parseValue(java.lang.String text)
Parses a null, boolean or numeric value from the given text.protected java.util.List<java.lang.Object>
readArray()
Reads a JSON array from the input stream.protected java.util.Map<java.lang.String,java.lang.Object>
readObject()
Reads the next JSON object from the stream.protected java.lang.String
readString()
Reads a JSON string value from the input stream.protected char
readUnicode()
Reads a Unicode character in JSON format.protected void
setReader(java.io.Reader in)
Set theReader
to read from.
-
-
-
Method Detail
-
setReader
protected void setReader(java.io.Reader in)
Set theReader
to read from.- Parameters:
in
- theReader
-
readObject
protected java.util.Map<java.lang.String,java.lang.Object> readObject() throws java.io.IOException
Reads the next JSON object from the stream.- Returns:
- the JSON object
Map
- Throws:
java.io.IOException
-
readArray
protected java.util.List<java.lang.Object> readArray() throws java.io.IOException
Reads a JSON array from the input stream.- Returns:
- the parsed JSON array
- Throws:
java.io.IOException
-
parseValue
protected java.lang.Object parseValue(java.lang.String text) throws java.io.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:
java.io.IOException
-
readString
protected java.lang.String readString() throws java.io.IOException
Reads a JSON string value from the input stream.- Returns:
- the JSON string value
- Throws:
java.io.IOException
-
readUnicode
protected char readUnicode() throws java.io.IOException
Reads a Unicode character in JSON format.- Returns:
- the Unicode character
- Throws:
java.io.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
-
-