- java.lang.Object
-
- org.redkale.convert.Reader
-
- 直接已知子类:
JsonReader,ProtobufReader
public abstract class Reader extends Object
反序列化的数据读取流详情见: https://redkale.org
- 作者:
- zhangjx
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classReader.ValueType
-
字段概要
字段 修饰符和类型 字段 说明 static shortSIGN_NULL集合对象为nullstatic shortSIGN_VARIABLE不确定的长度, 比如解析json数组
-
构造器概要
构造器 构造器 说明 Reader()
-
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 abstract booleanhasNext()是否还存在下个元素或字段abstract intposition()获取当前位置abstract voidprepare(byte[] content)设置Reader的内容,通常结合对象池使用abstract intreadArrayB(Decodeable componentDecoder)读取数组的开头并返回数组的长度abstract voidreadArrayE()读取数组的尾端abstract voidreadBlank()/跳过字段与值之间的多余内容, json就是跳过:符, map跳过:abstract booleanreadBoolean()读取一个boolean值abstract bytereadByte()读取一个byte值abstract byte[]readByteArray()读取byte[]abstract charreadChar()读取一个char值abstract doublereadDouble()读取一个double值abstract DeMemberreadField(DeMemberInfo memberInfo)根据字段读取字段对应的DeMemberabstract floatreadFloat()读取一个float值abstract intreadInt()读取一个int值abstract longreadLong()读取一个long值abstract intreadMapB(Decodeable keyDecoder, Decodeable valueDecoder)读取map的开头并返回map的sizeabstract voidreadMapE()读取数组的尾端StringreadObjectB(Class clazz)读取对象的类名, 返回 null 表示对象为null, 返回空字符串表示当前class与返回的class一致,返回非空字符串表示class是当前class的子类。abstract voidreadObjectE(Class clazz)读取对象的尾端abstract shortreadShort()读取一个short值abstract StringreadStandardString()读取无转义字符长度不超过255的字符串, 例如枚举值、字段名、类名字符串等abstract StringreadString()读取一个String值abstract Reader.ValueTypereadType()读取下个值的类型abstract voidskipValue()跳过值(不包含值前面的字段)
-
-
-
方法详细资料
-
prepare
public abstract void prepare(byte[] content)
设置Reader的内容,通常结合对象池使用- 参数:
content- 内容
-
hasNext
public abstract boolean hasNext()
是否还存在下个元素或字段- 返回:
- 是否还存在下个元素或字段
-
position
public abstract int position()
获取当前位置- 返回:
- 当前位置
-
skipValue
public abstract void skipValue()
跳过值(不包含值前面的字段)
-
readBlank
public abstract void readBlank()
/跳过字段与值之间的多余内容, json就是跳过:符, map跳过:
-
readType
public abstract Reader.ValueType readType()
读取下个值的类型- 返回:
- ValueType
-
readObjectB
public String readObjectB(Class clazz)
读取对象的类名, 返回 null 表示对象为null, 返回空字符串表示当前class与返回的class一致,返回非空字符串表示class是当前class的子类。- 参数:
clazz- 类名- 返回:
- 返回字段数
-
readObjectE
public abstract void readObjectE(Class clazz)
读取对象的尾端- 参数:
clazz- 类名
-
readArrayB
public abstract int readArrayB(@Nullable Decodeable componentDecoder)
读取数组的开头并返回数组的长度- 参数:
componentDecoder- Decodeable- 返回:
- 返回数组的长度
- 另请参阅:
SIGN_NULL,SIGN_VARIABLE
-
readArrayE
public abstract void readArrayE()
读取数组的尾端
-
readMapB
public abstract int readMapB(Decodeable keyDecoder, Decodeable valueDecoder)
读取map的开头并返回map的size- 参数:
keyDecoder- DecodeablevalueDecoder- Decodeable- 返回:
- 返回map的size
-
readMapE
public abstract void readMapE()
读取数组的尾端
-
readField
public abstract DeMember readField(DeMemberInfo memberInfo)
根据字段读取字段对应的DeMember- 参数:
memberInfo- DeMember信息- 返回:
- 匹配的DeMember
-
readBoolean
public abstract boolean readBoolean()
读取一个boolean值- 返回:
- boolean值
-
readByte
public abstract byte readByte()
读取一个byte值- 返回:
- byte值
-
readByteArray
public abstract byte[] readByteArray()
读取byte[]- 返回:
- byte[]
-
readChar
public abstract char readChar()
读取一个char值- 返回:
- char值
-
readShort
public abstract short readShort()
读取一个short值- 返回:
- short值
-
readInt
public abstract int readInt()
读取一个int值- 返回:
- int值
-
readLong
public abstract long readLong()
读取一个long值- 返回:
- long值
-
readFloat
public abstract float readFloat()
读取一个float值- 返回:
- float值
-
readDouble
public abstract double readDouble()
读取一个double值- 返回:
- double值
-
readStandardString
public abstract String readStandardString()
读取无转义字符长度不超过255的字符串, 例如枚举值、字段名、类名字符串等- 返回:
- String值
-
readString
public abstract String readString()
读取一个String值- 返回:
- String值
-
-