public class JsonReader extends Object implements ObjectReader
Modifier and Type | Field and Description |
---|---|
protected double |
_doubleValue |
protected long |
_intValue |
protected static int[] |
SKIPPED_TOKENS |
Constructor and Description |
---|
JsonReader(Reader reader,
boolean strictDoubleParse,
boolean readMetadata) |
JsonReader(String source) |
Modifier and Type | Method and Description |
---|---|
protected void |
begin(int character,
JsonType type) |
ObjectReader |
beginArray()
Starts reading an array.
|
ObjectReader |
beginObject()
Starts reading a object.
|
void |
close() |
int |
column() |
protected ValueType |
consumeLiteral()
Reads the next literal value into _booleanValue, _doubleValue or _intValue and returns the
type of the readed literal, possible values are : INTEGER, DOUBLE, BOOLEAN, NULL.
|
protected String |
consumeString(int token) |
protected ValueType |
consumeValue() |
JsonType |
enclosingType() |
protected void |
end(int character,
JsonType type) |
ObjectReader |
endArray()
Ends the array.
|
ObjectReader |
endObject()
Ends the object.
|
ValueType |
getValueType() |
boolean |
hasNext() |
protected boolean |
isEOF() |
String |
metadata(String name) |
String |
name() |
ValueType |
next()
If we are in a object it will read the next name/value pair and if we are in an array it will
read the next value (except if value is of complex type, in that case after the call to
next() you must use one of beginXXX methods).
|
ObjectReader |
nextObjectMetadata()
Will read nexts object metadata.
|
protected char |
readEscaped() |
protected void |
readMetadata() |
protected int |
readNextToken(boolean consume) |
int |
row() |
ObjectReader |
skipValue()
If the value is of complex type it will skip its content.
|
boolean |
valueAsBoolean() |
byte[] |
valueAsByteArray() |
double |
valueAsDouble() |
float |
valueAsFloat() |
int |
valueAsInt() |
long |
valueAsLong() |
short |
valueAsShort() |
String |
valueAsString() |
protected static final int[] SKIPPED_TOKENS
protected long _intValue
protected double _doubleValue
public JsonReader(String source)
public JsonReader(Reader reader, boolean strictDoubleParse, boolean readMetadata)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public ObjectReader beginArray()
ObjectReader
ObjectReader.endArray()
when the array
contains no more values.beginArray
in interface ObjectReader
public ObjectReader beginObject()
ObjectReader
ObjectReader.endObject()
when the
objects contains no more properties.beginObject
in interface ObjectReader
public ObjectReader nextObjectMetadata()
ObjectReader
ObjectReader.metadata(String)
method. For example if you call
ObjectReader.beginObject()
you wont be able to do it anymore (however you still can retrieve the
metadata!).nextObjectMetadata
in interface ObjectReader
public ObjectReader endArray()
ObjectReader
endArray
in interface ObjectReader
public ObjectReader endObject()
ObjectReader
endObject
in interface ObjectReader
public String name()
name
in interface ObjectReader
ObjectReader.next()
before.public String valueAsString()
valueAsString
in interface ObjectReader
public int valueAsInt()
valueAsInt
in interface ObjectReader
ObjectReader.valueAsString()
public long valueAsLong()
valueAsLong
in interface ObjectReader
ObjectReader.valueAsString()
public double valueAsDouble()
valueAsDouble
in interface ObjectReader
ObjectReader.valueAsString()
public short valueAsShort()
valueAsShort
in interface ObjectReader
ObjectReader.valueAsString()
public float valueAsFloat()
valueAsFloat
in interface ObjectReader
ObjectReader.valueAsString()
public boolean valueAsBoolean()
valueAsBoolean
in interface ObjectReader
ObjectReader.valueAsString()
public byte[] valueAsByteArray()
valueAsByteArray
in interface ObjectReader
public String metadata(String name)
metadata
in interface ObjectReader
name
- the name of the metadata to retrieve.public ValueType getValueType()
getValueType
in interface ObjectReader
ValueType
public ObjectReader skipValue()
ObjectReader
skipValue
in interface ObjectReader
public boolean hasNext()
hasNext
in interface ObjectReader
public ValueType next()
ObjectReader
next
in interface ObjectReader
ValueType
for possible types.public JsonType enclosingType()
enclosingType
in interface ObjectReader
protected final ValueType consumeValue()
protected final void readMetadata()
protected final void begin(int character, JsonType type)
protected final void end(int character, JsonType type)
protected final String consumeString(int token)
protected final ValueType consumeLiteral()
readNextToken(boolean)
.protected final int readNextToken(boolean consume)
protected final char readEscaped()
protected final boolean isEOF()
public int column()
column
in interface ObjectReader
public int row()
row
in interface ObjectReader
Copyright © 2019. All rights reserved.