Package one.nio.serial
Class JsonReader
- java.lang.Object
-
- one.nio.serial.JsonReader
-
public class JsonReader extends Object
Beware: this is NOT a complete and fully compliant JSON parser! Its main purpose is to decode typical simple queries without third-party dependencies.
-
-
Constructor Summary
Constructors Constructor Description JsonReader(byte[] array)JsonReader(byte[] array, int offset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IOExceptionexception(String message)voidexpect(int b, String message)intnext()protected intread()ArrayList<Object>readArray()ArrayList<Object>readArray(Type elementType)byte[]readBinary()booleanreadBoolean()bytereadByte()charreadChar()doublereadDouble()charreadEscapeChar()floatreadFloat()intreadHexChar()intreadInt()longreadLong()Map<String,Object>readMap()<K> Map<K,Object>readMap(Class<K> keyClass, Type valueType)ObjectreadNull()StringreadNumber()ObjectreadObject()<T> TreadObject(Class<T> cls)ObjectreadObject(Type type)shortreadShort()StringreadString()intskipWhitespace()
-
-
-
Method Detail
-
read
protected int read()
-
next
public final int next()
-
skipWhitespace
public final int skipWhitespace()
-
exception
public final IOException exception(String message)
-
expect
public final void expect(int b, String message) throws IOException- Throws:
IOException
-
readBoolean
public final boolean readBoolean() throws IOException- Throws:
IOException
-
readByte
public final byte readByte() throws IOException- Throws:
IOException
-
readShort
public final short readShort() throws IOException- Throws:
IOException
-
readChar
public final char readChar() throws IOException- Throws:
IOException
-
readInt
public final int readInt() throws IOException- Throws:
IOException
-
readLong
public final long readLong() throws IOException- Throws:
IOException
-
readFloat
public float readFloat() throws IOException- Throws:
IOException
-
readDouble
public final double readDouble() throws IOException- Throws:
IOException
-
readNumber
public final String readNumber() throws IOException
- Throws:
IOException
-
readHexChar
public final int readHexChar() throws IOException- Throws:
IOException
-
readEscapeChar
public final char readEscapeChar() throws IOException- Throws:
IOException
-
readNull
public Object readNull() throws IOException
- Throws:
IOException
-
readString
public String readString() throws IOException
- Throws:
IOException
-
readBinary
public byte[] readBinary() throws IOException- Throws:
IOException
-
readArray
public ArrayList<Object> readArray() throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
readArray
public ArrayList<Object> readArray(Type elementType) throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
readMap
public Map<String,Object> readMap() throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
readMap
public <K> Map<K,Object> readMap(Class<K> keyClass, Type valueType) throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
readObject
public Object readObject() throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
readObject
public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
readObject
public Object readObject(Type type) throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
-