public class EventReader
extends java.lang.Object
EventWriter
.
To ease deserialization of one event and to reduce the amount of parameters, EventReader keeps state of the deserialization of the event. For sake of simplicity, the EventReader automatically consumes separators.
Thus, the instance might be shared and reused to reduce object creation overhead, as long as events are deserialized one after the other and within the same thread.
Constructor and Description |
---|
EventReader() |
Modifier and Type | Method and Description |
---|---|
boolean |
hasMore() |
boolean |
readBoolean()
Read the property value as boolean.
|
double |
readDouble()
Read the property value as double.
|
double |
readDoubleOrZero()
Read the property value as double or zero if values is empty.
|
<T extends java.lang.Enum<T>> |
readEnum(java.lang.Class<T> c)
Read the property value as enumeration.
|
long |
readLong()
Read the property value as long integer.
|
long |
readLongOrZero()
Read the property value as long integer or zero if values is empty.
|
java.util.Map<java.lang.String,java.lang.String> |
readMap()
Read the property value as a map of string key and values.
|
protected java.lang.String |
readMapKey() |
protected java.lang.String |
readMapValue() |
protected boolean |
readOptionalSymbol(char symbol)
Consumes an optional symbol if available.
|
protected java.lang.String |
readPropertyKey() |
java.lang.String |
readPropertyName()
Read a name of the next expected incoming property.
|
protected java.lang.String |
readPropertyValue() |
java.lang.String |
readString()
Read the property value as string.
|
protected void |
readSymbol(char symbol)
Consumes an expected symbol.
|
EventReader |
reset(java.lang.String encodedData) |
public EventReader reset(java.lang.String encodedData)
public boolean hasMore()
public java.lang.String readPropertyName() throws java.io.IOException
java.io.IOException
- Incoming chars are not a valid property name.public java.lang.String readString() throws java.io.IOException
java.io.IOException
- Incoming chars are not a valid property value.public boolean readBoolean() throws java.io.IOException
java.io.IOException
- Incoming chars are not a valid property value.public <T extends java.lang.Enum<T>> T readEnum(java.lang.Class<T> c) throws java.io.IOException
T
- type of enumerationc
- class of enumerationjava.io.IOException
- Incoming chars are not a valid property value.public long readLong() throws java.io.IOException
java.io.IOException
- Incoming chars are not a valid property value.public long readLongOrZero() throws java.io.IOException
java.io.IOException
- Incoming chars are not a valid property value.public double readDouble() throws java.io.IOException
java.io.IOException
- Incoming chars are not a valid property value.public double readDoubleOrZero() throws java.io.IOException
java.io.IOException
- Incoming chars are not a valid property value.protected void readSymbol(char symbol) throws java.io.IOException
symbol
- the expected symbol.java.io.IOException
- All chars were consumed or incoming char is not the expected symbol.protected boolean readOptionalSymbol(char symbol) throws java.io.IOException
symbol
- the optionally expected symbol.java.io.IOException
- All chars were consumed.public java.util.Map<java.lang.String,java.lang.String> readMap() throws java.io.IOException
java.io.IOException
- Incoming chars are not a valid property value.protected java.lang.String readMapKey() throws java.io.IOException
java.io.IOException
protected java.lang.String readMapValue() throws java.io.IOException
java.io.IOException
protected java.lang.String readPropertyValue() throws java.io.EOFException
java.io.EOFException
protected java.lang.String readPropertyKey() throws java.io.IOException
java.io.IOException