Package com.fauna.codec
Class UTF8FaunaParser
- java.lang.Object
-
- com.fauna.codec.UTF8FaunaParser
-
public final class UTF8FaunaParser extends java.lang.ObjectRepresents a reader that provides fast, non-cached, forward-only access to serialized data.
-
-
Constructor Summary
Constructors Constructor Description UTF8FaunaParser(com.fasterxml.jackson.core.JsonParser jsonParser)Constructs aUTF8FaunaParserinstance with the given JSON parser.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UTF8FaunaParserfromInputStream(java.io.InputStream body)Creates aUTF8FaunaParserfrom anInputStream.static UTF8FaunaParserfromString(java.lang.String str)Creates aUTF8FaunaParserfrom a JSON stringFaunaTokenTypegetCurrentTokenType()Retrieves the current Fauna token type.java.lang.StringgetTaggedValueAsString()Retrieves the tagged value as aString.java.lang.BooleangetValueAsBoolean()Retrieves the current value as aBoolean.java.lang.BytegetValueAsByte()Retrieves the value as aByteif the current token type isFaunaTokenType.INT.byte[]getValueAsByteArray()Retrieves the value as a byte array if the current token type isFaunaTokenType.BYTES.java.lang.CharactergetValueAsCharacter()Retrieves the value as aCharacterif the current token type isFaunaTokenType.INT.java.lang.DoublegetValueAsDouble()Retrieves the value as aDoubleif the current token type isFaunaTokenType.INT,FaunaTokenType.LONG, orFaunaTokenType.DOUBLE.java.lang.FloatgetValueAsFloat()Retrieves the value as aFloatif the current token type isFaunaTokenType.INT,FaunaTokenType.LONG, orFaunaTokenType.DOUBLE.java.lang.IntegergetValueAsInt()Retrieves the value as anIntegerif the current token type isFaunaTokenType.INTorFaunaTokenType.LONG.java.time.LocalDategetValueAsLocalDate()Retrieves the current value as aLocalDateif the current token type isFaunaTokenType.DATE.java.lang.LonggetValueAsLong()Retrieves the value as aLongif the current token type isFaunaTokenType.INTorFaunaTokenType.LONG.ModulegetValueAsModule()Retrieves the value as aModuleif the current token type isFaunaTokenType.MODULE.java.lang.ShortgetValueAsShort()Retrieves the value as aShortif the current token type isFaunaTokenType.INT.java.lang.StringgetValueAsString()Retrieves the current value as aString.java.time.InstantgetValueAsTime()Retrieves the current value as anInstantif the current token type isFaunaTokenType.TIME.booleanread()Reads the next token from the JSON parser.voidskip()Skips the current object or array in the JSON data.
-
-
-
Method Detail
-
fromInputStream
public static UTF8FaunaParser fromInputStream(java.io.InputStream body) throws CodecException
Creates aUTF8FaunaParserfrom anInputStream.- Parameters:
body- The input stream of JSON data.- Returns:
- A
UTF8FaunaParserinstance. - Throws:
CodecException- if anIOExceptionoccurs while creating the parser.
-
fromString
public static UTF8FaunaParser fromString(java.lang.String str)
Creates aUTF8FaunaParserfrom a JSON string- Parameters:
str- The JSON string.- Returns:
- A
UTF8FaunaParserinstance.
-
getCurrentTokenType
public FaunaTokenType getCurrentTokenType()
Retrieves the current Fauna token type.- Returns:
- The
FaunaTokenTypecurrently being processed.
-
skip
public void skip()
Skips the current object or array in the JSON data.
-
read
public boolean read() throws CodecExceptionReads the next token from the JSON parser.- Returns:
trueif there is another token to read,falseif there are no more tokens.- Throws:
CodecException- if there is an error reading the token.
-
getValueAsCharacter
public java.lang.Character getValueAsCharacter()
Retrieves the value as aCharacterif the current token type isFaunaTokenType.INT.- Returns:
- The current value as a
Character.
-
getValueAsString
public java.lang.String getValueAsString()
Retrieves the current value as aString.- Returns:
- The current value as a
String.
-
getTaggedValueAsString
public java.lang.String getTaggedValueAsString()
Retrieves the tagged value as aString.- Returns:
- The tagged value as a
String.
-
getValueAsByteArray
public byte[] getValueAsByteArray()
Retrieves the value as a byte array if the current token type isFaunaTokenType.BYTES.- Returns:
- The current value as a byte array.
-
getValueAsByte
public java.lang.Byte getValueAsByte()
Retrieves the value as aByteif the current token type isFaunaTokenType.INT.- Returns:
- The current value as a
Byte.
-
getValueAsShort
public java.lang.Short getValueAsShort()
Retrieves the value as aShortif the current token type isFaunaTokenType.INT.- Returns:
- The current value as a
Short.
-
getValueAsInt
public java.lang.Integer getValueAsInt()
Retrieves the value as anIntegerif the current token type isFaunaTokenType.INTorFaunaTokenType.LONG.- Returns:
- The current value as an
Integer.
-
getValueAsBoolean
public java.lang.Boolean getValueAsBoolean()
Retrieves the current value as aBoolean.- Returns:
- The current value as a
Boolean.
-
getValueAsLocalDate
public java.time.LocalDate getValueAsLocalDate()
Retrieves the current value as aLocalDateif the current token type isFaunaTokenType.DATE.- Returns:
- The current value as a
LocalDate.
-
getValueAsTime
public java.time.Instant getValueAsTime()
Retrieves the current value as anInstantif the current token type isFaunaTokenType.TIME.- Returns:
- The current value as an
Instant.
-
getValueAsFloat
public java.lang.Float getValueAsFloat()
Retrieves the value as aFloatif the current token type isFaunaTokenType.INT,FaunaTokenType.LONG, orFaunaTokenType.DOUBLE.- Returns:
- The current value as a
Float.
-
getValueAsDouble
public java.lang.Double getValueAsDouble()
Retrieves the value as aDoubleif the current token type isFaunaTokenType.INT,FaunaTokenType.LONG, orFaunaTokenType.DOUBLE.- Returns:
- The current value as a
Double.
-
getValueAsLong
public java.lang.Long getValueAsLong()
Retrieves the value as aLongif the current token type isFaunaTokenType.INTorFaunaTokenType.LONG.- Returns:
- The current value as a
Long.
-
getValueAsModule
public Module getValueAsModule()
Retrieves the value as aModuleif the current token type isFaunaTokenType.MODULE.- Returns:
- The current value as a
Module.
-
-