Interface StreamingInput
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
AbstractStreamingInput,BinaryInput,JsonInput
public interface StreamingInput extends Closeable
Input that is streamed as a set of token with values.
- Author:
- Andreas Holstenson
-
Method Summary
Modifier and Type Method Description Tokencurrent()Get the current token.booleangetBoolean()Get the value as a boolean.default bytegetByte()Get the value as a byte.byte[]getByteArray()Get the value as a byte[] array.default chargetChar()Get the value as a character.doublegetDouble()Get the value as a double.floatgetFloat()Get the value as a float.intgetInt()Get the value as an integer.longgetLong()Get the value as a long.shortgetShort()Get the value as a short.StringgetString()Get the current value as a string.ObjectgetValue()Get the current value.default ValueTypegetValueType()Get the type of value the input currently has.Tokennext()Advance to the next token.Tokennext(Token expected)Advance to the next token checking that it is of a certain type.Tokenpeek()Peek into the stream and return the next token.voidskip()Skip the started object, list or value.voidskipValue()If this token is aToken.KEYthis will skip its value.
-
Method Details
-
peek
Peek into the stream and return the next token.- Returns:
- Throws:
IOException
-
next
Advance to the next token.- Returns:
- Throws:
IOException
-
next
Advance to the next token checking that it is of a certain type.- Parameters:
expected-- Returns:
- Throws:
IOException
-
skip
Skip the started object, list or value. This method should only be used when when token is eitherToken.OBJECT_START,Token.LIST_STARTorToken.VALUE. SeeskipValue()for skipping reading when the current token isToken.KEY.- Throws:
IOException
-
skipValue
If this token is aToken.KEYthis will skip its value.- Throws:
IOException
-
current
Token current()Get the current token.- Returns:
-
getValueType
Get the type of value the input currently has. If thecurrent tokenis notToken.VALUEorToken.NULLthis method will raise aSerializationException.The type of value is defined by the input, and many number values can be converted.
- Returns:
- current type of value
-
getValue
Object getValue()Get the current value.- Returns:
-
getString
String getString()Get the current value as a string.- Returns:
-
getBoolean
boolean getBoolean()Get the value as a boolean.- Returns:
-
getByte
default byte getByte()Get the value as a byte.- Returns:
-
getChar
default char getChar()Get the value as a character.- Returns:
-
getDouble
double getDouble()Get the value as a double.- Returns:
-
getFloat
float getFloat()Get the value as a float.- Returns:
-
getLong
long getLong()Get the value as a long.- Returns:
-
getInt
int getInt()Get the value as an integer.- Returns:
-
getShort
short getShort()Get the value as a short.- Returns:
-
getByteArray
byte[] getByteArray()Get the value as a byte[] array.- Returns:
-