public abstract class ForwardingProtocolReader extends java.lang.Object implements ProtocolReader
Useful for wrapping and subclassing without inheritance.
SCOPE_ARRAY, SCOPE_NONE, SCOPE_OBJECT| Modifier and Type | Method and Description |
|---|---|
void |
beginArray()
Begin reading an array from the source
|
void |
beginObject()
Begin reading an object from the source
|
void |
close()
Close the data source
|
int |
currentScope()
Get the current scope of the reader
|
void |
endArray()
End reading an array from the source
|
void |
endObject()
End reading an object from the source
|
boolean |
hasNext()
Check if the source has more data to read
|
ProtocolReader |
newPeekingReader()
Get a new instance peeking instance of this reader.
|
TypeToken |
peek()
Peek the data and check what is the type of the data that follows
|
boolean |
readBoolean()
Read a boolean value from the source
|
long |
readNumber()
Read a number from the source
|
java.lang.String |
readString()
Read a String from the source
|
void |
skipValue()
Consume and discard the next value
|
public int currentScope()
ProtocolReaderReturn values can be ProtocolReader.SCOPE_NONE, ProtocolReader.SCOPE_OBJECT, ProtocolReader.SCOPE_ARRAY, ProtocolResponseReader.SCOPE_RESPONSE
currentScope in interface ProtocolReaderpublic TypeToken peek() throws java.io.IOException
ProtocolReaderReturn values can be TypeToken.BEGIN_OBJECT, TypeToken.BEGIN_ARRAY, TypeToken.END_OBJECT, TypeToken.END_ARRAY, TypeToken.STRING, TypeToken.BOOLEAN, TypeToken.NUMBER
peek in interface ProtocolReaderjava.io.IOException - if the source is exhausted before the next bytes can be readTypeTokenpublic void beginObject()
throws java.io.IOException
ProtocolReaderbeginObject in interface ProtocolReaderjava.io.IOException - if the source has been exhaustedpublic void beginArray()
throws java.io.IOException
ProtocolReaderbeginArray in interface ProtocolReaderjava.io.IOException - if the source has been exhaustedpublic void endArray()
throws java.io.IOException
ProtocolReaderendArray in interface ProtocolReaderjava.io.IOException - if the source has been exhaustedpublic void endObject()
throws java.io.IOException
ProtocolReaderendObject in interface ProtocolReaderjava.io.IOException - if the source has been exhaustedpublic boolean readBoolean()
throws java.io.IOException
ProtocolReaderreadBoolean in interface ProtocolReaderjava.io.IOException - if the source has been exhaustedpublic java.lang.String readString()
throws java.io.IOException
ProtocolReaderreadString in interface ProtocolReaderjava.io.IOException - if the source is exhaustedpublic long readNumber()
throws java.io.IOException
ProtocolReaderreadNumber in interface ProtocolReaderjava.io.IOException - if the source is exhaustedpublic void close()
ProtocolReaderclose in interface ProtocolReaderclose in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic boolean hasNext()
throws java.io.IOException
ProtocolReaderhasNext in interface ProtocolReaderjava.io.IOException - if the source has been exhaustedpublic void skipValue()
throws java.io.IOException
ProtocolReaderskipValue in interface ProtocolReaderjava.io.IOException - if the source has been exhaustedpublic ProtocolReader newPeekingReader()
ProtocolReaderThe peeking reader can read data without consuming it. It inherits all the fields of the current instance such as the data source and the scope. Any operations with the peeking reader will not exhaust the data source.
newPeekingReader in interface ProtocolReader