Package com.alibaba.fastjson.parser
Class JSONLexerBase
- java.lang.Object
-
- com.alibaba.fastjson.parser.JSONLexerBase
-
- All Implemented Interfaces:
JSONLexer,Closeable,AutoCloseable
- Direct Known Subclasses:
JSONReaderScanner,JSONScanner
public abstract class JSONLexerBase extends Object implements JSONLexer, Closeable
- Author:
- wenshao[szujobs@hotmail.com]
-
-
Constructor Summary
Constructors Constructor Description JSONLexerBase(int features)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract StringaddSymbol(int offset, int len, int hash, SymbolTable symbolTable)abstract byte[]bytesValue()abstract charcharAt(int index)voidclose()voidconfig(Feature feature, boolean state)abstract BigDecimaldecimalValue()NumberdecimalValue(boolean decimal)doubledoubleValue()floatfloatValue()CalendargetCalendar()chargetCurrent()intgetFeatures()LocalegetLocale()TimeZonegetTimeZone()abstract intindexOf(char ch, int startIndex)Stringinfo()NumberintegerValue()intintValue()booleanisBlankInput()booleanisEnabled(int feature)booleanisEnabled(int features, int feature)booleanisEnabled(Feature feature)abstract booleanisEOF()booleanisRef()static booleanisWhitespace(char ch)longlongValue()booleanmatchField(char[] fieldName)intmatchField(long fieldNameHash)booleanmatchField2(char[] fieldName)intmatchStat()Collection<String>newCollectionByType(Class<?> type)abstract charnext()voidnextIdent()voidnextToken()voidnextToken(int expect)voidnextTokenWithChar(char expect)voidnextTokenWithColon()voidnextTokenWithColon(int expect)abstract StringnumberString()intpos()static StringreadString(char[] chars, int chars_len)voidresetStringPosition()booleanscanBoolean(char expectNext)DatescanDate(char seperator)BigDecimalscanDecimal(char seperator)doublescanDouble(char seperator)Enum<?>scanEnum(Class<?> enumClass, SymbolTable symbolTable, char serperator)longscanEnumSymbol(char[] fieldName)voidscanFalse()BigIntegerscanFieldBigInteger(char[] fieldName)booleanscanFieldBoolean(char[] fieldName)DatescanFieldDate(char[] fieldName)BigDecimalscanFieldDecimal(char[] fieldName)doublescanFieldDouble(char[] fieldName)floatscanFieldFloat(char[] fieldName)float[]scanFieldFloatArray(char[] fieldName)float[][]scanFieldFloatArray2(char[] fieldName)intscanFieldInt(char[] fieldName)int[]scanFieldIntArray(char[] fieldName)longscanFieldLong(char[] fieldName)StringscanFieldString(char[] fieldName)String[]scanFieldStringArray(char[] fieldName, int argTypesCount, SymbolTable typeSymbolTable)hsf supportCollection<String>scanFieldStringArray(char[] fieldName, Class<?> type)longscanFieldSymbol(char[] fieldName)UUIDscanFieldUUID(char[] fieldName)floatscanFloat(char seperator)voidscanHex()voidscanIdent()intscanInt(char expectNext)longscanLong(char expectNextChar)voidscanNullOrNew()voidscanNullOrNew(boolean acceptColon)voidscanNumber()voidscanString()StringscanString(char expectNextChar)voidscanStringArray(Collection<String> list, char seperator)StringscanSymbol(SymbolTable symbolTable)StringscanSymbol(SymbolTable symbolTable, char quote)StringscanSymbolUnQuoted(SymbolTable symbolTable)StringscanSymbolWithSeperator(SymbolTable symbolTable, char serperator)voidscanTrue()intscanType(String type)StringscanTypeName(SymbolTable symbolTable)UUIDscanUUID(char seperator)booleanseekArrayToItem(int index)intseekObjectToField(long[] fieldNameHash)intseekObjectToField(long fieldNameHash, boolean deepScan)intseekObjectToFieldDeepScan(long fieldNameHash)voidsetFeatures(int features)voidsetLocale(Locale locale)voidsetTimeZone(TimeZone timeZone)voidsetToken(int token)internal method, don't invokevoidskipArray()voidskipObject()voidskipObject(boolean valid)voidskipWhitespace()StringstringDefaultValue()abstract StringstringVal()abstract StringsubString(int offset, int count)inttoken()StringtokenName()
-
-
-
Method Detail
-
matchStat
public final int matchStat()
-
setToken
public void setToken(int token)
internal method, don't invoke- Parameters:
token-
-
nextIdent
public final void nextIdent()
-
nextTokenWithColon
public final void nextTokenWithColon()
- Specified by:
nextTokenWithColonin interfaceJSONLexer
-
nextTokenWithChar
public final void nextTokenWithChar(char expect)
-
stringDefaultValue
public final String stringDefaultValue()
-
integerValue
public final Number integerValue() throws NumberFormatException
- Specified by:
integerValuein interfaceJSONLexer- Throws:
NumberFormatException
-
nextTokenWithColon
public final void nextTokenWithColon(int expect)
- Specified by:
nextTokenWithColonin interfaceJSONLexer
-
floatValue
public float floatValue()
- Specified by:
floatValuein interfaceJSONLexer
-
doubleValue
public double doubleValue()
-
config
public void config(Feature feature, boolean state)
-
isEnabled
public final boolean isEnabled(Feature feature)
-
isEnabled
public final boolean isEnabled(int feature)
-
isEnabled
public final boolean isEnabled(int features, int feature)
-
numberString
public abstract String numberString()
- Specified by:
numberStringin interfaceJSONLexer
-
isEOF
public abstract boolean isEOF()
-
getCurrent
public final char getCurrent()
- Specified by:
getCurrentin interfaceJSONLexer
-
charAt
public abstract char charAt(int index)
-
scanSymbol
public final String scanSymbol(SymbolTable symbolTable)
- Specified by:
scanSymbolin interfaceJSONLexer
-
scanSymbol
public final String scanSymbol(SymbolTable symbolTable, char quote)
- Specified by:
scanSymbolin interfaceJSONLexer
-
resetStringPosition
public final void resetStringPosition()
- Specified by:
resetStringPositionin interfaceJSONLexer
-
scanSymbolUnQuoted
public final String scanSymbolUnQuoted(SymbolTable symbolTable)
- Specified by:
scanSymbolUnQuotedin interfaceJSONLexer
-
scanString
public final void scanString()
- Specified by:
scanStringin interfaceJSONLexer
-
getCalendar
public Calendar getCalendar()
-
getTimeZone
public TimeZone getTimeZone()
- Specified by:
getTimeZonein interfaceJSONLexer
-
setTimeZone
public void setTimeZone(TimeZone timeZone)
- Specified by:
setTimeZonein interfaceJSONLexer
-
bytesValue
public abstract byte[] bytesValue()
- Specified by:
bytesValuein interfaceJSONLexer
-
close
public void close()
-
scanTypeName
public String scanTypeName(SymbolTable symbolTable)
- Specified by:
scanTypeNamein interfaceJSONLexer
-
scanType
public final int scanType(String type)
-
matchField
public final boolean matchField(char[] fieldName)
-
matchField
public int matchField(long fieldNameHash)
-
seekArrayToItem
public boolean seekArrayToItem(int index)
-
seekObjectToField
public int seekObjectToField(long fieldNameHash, boolean deepScan)
-
seekObjectToField
public int seekObjectToField(long[] fieldNameHash)
-
seekObjectToFieldDeepScan
public int seekObjectToFieldDeepScan(long fieldNameHash)
-
skipObject
public void skipObject()
-
skipObject
public void skipObject(boolean valid)
-
skipArray
public void skipArray()
-
indexOf
public abstract int indexOf(char ch, int startIndex)
-
addSymbol
public abstract String addSymbol(int offset, int len, int hash, SymbolTable symbolTable)
-
scanFieldString
public String scanFieldString(char[] fieldName)
-
scanString
public String scanString(char expectNextChar)
- Specified by:
scanStringin interfaceJSONLexer
-
scanFieldSymbol
public long scanFieldSymbol(char[] fieldName)
-
scanEnumSymbol
public long scanEnumSymbol(char[] fieldName)
-
scanEnum
public Enum<?> scanEnum(Class<?> enumClass, SymbolTable symbolTable, char serperator)
-
scanSymbolWithSeperator
public String scanSymbolWithSeperator(SymbolTable symbolTable, char serperator)
- Specified by:
scanSymbolWithSeperatorin interfaceJSONLexer
-
newCollectionByType
public Collection<String> newCollectionByType(Class<?> type)
-
scanFieldStringArray
public Collection<String> scanFieldStringArray(char[] fieldName, Class<?> type)
-
scanStringArray
public void scanStringArray(Collection<String> list, char seperator)
- Specified by:
scanStringArrayin interfaceJSONLexer
-
scanFieldInt
public int scanFieldInt(char[] fieldName)
-
scanFieldIntArray
public final int[] scanFieldIntArray(char[] fieldName)
-
scanBoolean
public boolean scanBoolean(char expectNext)
- Specified by:
scanBooleanin interfaceJSONLexer
-
scanFieldBoolean
public boolean scanFieldBoolean(char[] fieldName)
-
scanFieldLong
public long scanFieldLong(char[] fieldName)
-
scanFieldFloat
public final float scanFieldFloat(char[] fieldName)
-
scanFloat
public final float scanFloat(char seperator)
-
scanDouble
public double scanDouble(char seperator)
- Specified by:
scanDoublein interfaceJSONLexer
-
scanDecimal
public BigDecimal scanDecimal(char seperator)
- Specified by:
scanDecimalin interfaceJSONLexer
-
scanFieldFloatArray
public final float[] scanFieldFloatArray(char[] fieldName)
-
scanFieldFloatArray2
public final float[][] scanFieldFloatArray2(char[] fieldName)
-
scanFieldDouble
public final double scanFieldDouble(char[] fieldName)
-
scanFieldDecimal
public BigDecimal scanFieldDecimal(char[] fieldName)
-
scanFieldBigInteger
public BigInteger scanFieldBigInteger(char[] fieldName)
-
scanFieldDate
public Date scanFieldDate(char[] fieldName)
-
scanDate
public Date scanDate(char seperator)
-
scanFieldUUID
public UUID scanFieldUUID(char[] fieldName)
-
scanUUID
public UUID scanUUID(char seperator)
-
scanTrue
public final void scanTrue()
-
scanNullOrNew
public final void scanNullOrNew()
-
scanNullOrNew
public final void scanNullOrNew(boolean acceptColon)
-
scanFalse
public final void scanFalse()
-
scanIdent
public final void scanIdent()
-
subString
public abstract String subString(int offset, int count)
-
readString
public static String readString(char[] chars, int chars_len)
-
isBlankInput
public boolean isBlankInput()
- Specified by:
isBlankInputin interfaceJSONLexer
-
skipWhitespace
public final void skipWhitespace()
- Specified by:
skipWhitespacein interfaceJSONLexer
-
scanHex
public final void scanHex()
-
scanNumber
public final void scanNumber()
- Specified by:
scanNumberin interfaceJSONLexer
-
longValue
public final long longValue() throws NumberFormatException- Specified by:
longValuein interfaceJSONLexer- Throws:
NumberFormatException
-
decimalValue
public final Number decimalValue(boolean decimal)
- Specified by:
decimalValuein interfaceJSONLexer
-
decimalValue
public abstract BigDecimal decimalValue()
- Specified by:
decimalValuein interfaceJSONLexer
-
isWhitespace
public static boolean isWhitespace(char ch)
-
scanFieldStringArray
public String[] scanFieldStringArray(char[] fieldName, int argTypesCount, SymbolTable typeSymbolTable)
hsf support- Parameters:
fieldName-argTypesCount-typeSymbolTable-- Returns:
-
matchField2
public boolean matchField2(char[] fieldName)
-
getFeatures
public int getFeatures()
- Specified by:
getFeaturesin interfaceJSONLexer
-
setFeatures
public void setFeatures(int features)
- Specified by:
setFeaturesin interfaceJSONLexer
-
-