Package net.morimekta.util.json
Class JsonToken
- java.lang.Object
-
- net.morimekta.util.CharSlice
-
- net.morimekta.util.json.JsonToken
-
- All Implemented Interfaces:
java.lang.CharSequence
,java.lang.Comparable<CharSlice>
,Stringable
public class JsonToken extends CharSlice
- Since:
- 19.10.15
- Author:
- Stein Eldar Johnsen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonToken.Type
-
Field Summary
Fields Modifier and Type Field Description static char
kKeyValSep
static char
kListEnd
static char
kListSep
static char
kListStart
static char
kMapEnd
static char
kMapStart
int
lineNo
int
linePos
JsonToken.Type
type
-
Constructor Summary
Constructors Constructor Description JsonToken(JsonToken.Type type, char[] lineBuffer, int offset, int len, int lineNo, int linePos)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
booleanValue()
byte
byteValue()
java.lang.String
decodeJsonLiteral()
Get the whole slice as a string.double
doubleValue()
boolean
equals(java.lang.Object o)
int
getLineNo()
int
getLinePos()
JsonToken.Type
getType()
int
hashCode()
int
intValue()
boolean
isBoolean()
boolean
isDouble()
boolean
isInteger()
boolean
isLiteral()
boolean
isNull()
boolean
isNumber()
boolean
isSymbol()
boolean
isSymbol(char c)
long
longValue()
java.lang.String
rawJsonLiteral()
Get the still quoted string literal content.short
shortValue()
java.lang.String
toString()
-
Methods inherited from class net.morimekta.util.CharSlice
asString, charAt, compareTo, contains, contains, containsAny, length, offset, parseDouble, parseInteger, strEquals, strEquals, subSequence, substring
-
-
-
-
Field Detail
-
kListStart
public static final char kListStart
- See Also:
- Constant Field Values
-
kListEnd
public static final char kListEnd
- See Also:
- Constant Field Values
-
kListSep
public static final char kListSep
- See Also:
- Constant Field Values
-
kMapStart
public static final char kMapStart
- See Also:
- Constant Field Values
-
kMapEnd
public static final char kMapEnd
- See Also:
- Constant Field Values
-
kKeyValSep
public static final char kKeyValSep
- See Also:
- Constant Field Values
-
type
public final JsonToken.Type type
-
lineNo
public final int lineNo
-
linePos
public final int linePos
-
-
Constructor Detail
-
JsonToken
public JsonToken(JsonToken.Type type, char[] lineBuffer, int offset, int len, int lineNo, int linePos)
-
-
Method Detail
-
getType
public JsonToken.Type getType()
- Returns:
- The token type.
-
getLineNo
public int getLineNo()
- Returns:
- The line number (1-indexed).
-
getLinePos
public int getLinePos()
- Returns:
- The start position on the line (0-indexed).
-
isNull
public boolean isNull()
-
isSymbol
public boolean isSymbol()
-
isSymbol
public final boolean isSymbol(char c)
-
isLiteral
public boolean isLiteral()
-
isBoolean
public boolean isBoolean()
-
isNumber
public boolean isNumber()
-
isInteger
public boolean isInteger()
-
isDouble
public boolean isDouble()
-
booleanValue
public boolean booleanValue()
-
byteValue
public byte byteValue()
-
shortValue
public short shortValue()
-
intValue
public int intValue()
-
longValue
public long longValue()
-
doubleValue
public double doubleValue()
-
rawJsonLiteral
public java.lang.String rawJsonLiteral()
Get the still quoted string literal content.- Returns:
- The raw string literal.
-
decodeJsonLiteral
public java.lang.String decodeJsonLiteral()
Get the whole slice as a string.- Returns:
- Slice decoded as UTF_8 string.
-
-