public class BsonReader extends Reader
详情见: https://redkale.org
Reader.ValueType
限定符和类型 | 字段和说明 |
---|---|
protected int |
position |
static byte |
SIGN_HASNEXT |
static byte |
SIGN_NONEXT |
static short |
SIGN_OBJECTB |
static short |
SIGN_OBJECTE |
protected byte |
typeval |
static byte |
VERBOSE_NO |
static byte |
VERBOSE_YES |
fieldIndex, SIGN_NOLENBUTBYTES, SIGN_NOLENGTH, SIGN_NULL
构造器和说明 |
---|
BsonReader() |
BsonReader(byte[] bytes) |
BsonReader(byte[] bytes,
int start,
int len) |
限定符和类型 | 方法和说明 |
---|---|
void |
close() |
static ObjectPool<BsonReader> |
createPool(int max) |
protected byte |
currentByte() |
boolean |
hasNext(int startPosition,
int contentLength)
判断对象是否存在下一个属性或者数组是否存在下一个元素
|
int |
position()
获取当前位置
|
int |
readArrayB(DeMember member,
byte[] typevals,
Decodeable componentDecoder)
判断下一个非空白字节是否为[
|
void |
readArrayE()
读取数组的尾端
|
void |
readBlank()
判断下一个非空白字节是否:
|
boolean |
readBoolean()
读取一个boolean值
|
byte |
readByte()
读取一个byte值
|
byte[] |
readByteArray()
读取byte[]
|
char |
readChar()
读取一个char值
|
java.lang.String |
readClassName()
读取反解析对象的类名
|
double |
readDouble()
读取一个double值
|
DeMember |
readFieldName(DeMember[] members)
根据字段读取字段对应的DeMember
|
float |
readFloat()
读取一个float值
|
int |
readInt()
读取一个int值
|
long |
readLong()
读取一个long值
|
int |
readMapB(DeMember member,
byte[] typevals,
Decodeable keyDecoder,
Decodeable valueDecoder)
读取map的开头并返回map的size
|
void |
readMapE()
读取数组的尾端
|
int |
readMemberContentLength(DeMember member,
Decodeable decoder)
读取字段值内容的字节数
只有在readXXXB方法返回SIGN_NOLENBUTBYTES值才会调用此方法 |
java.lang.String |
readObjectB(java.lang.Class clazz)
读取对象的类名, 返回 null 表示对象为null, 返回空字符串表示当前class与返回的class一致,返回非空字符串表示class是当前class的子类。
|
void |
readObjectE(java.lang.Class clazz)
读取对象的尾端
|
short |
readShort()
读取一个short值
|
java.lang.String |
readSmallString()
读取无转义字符长度不超过255的字符串, 例如枚举值、字段名、类名字符串等
|
java.lang.String |
readString()
读取一个String值
|
Reader.ValueType |
readType()
读取下个值的类型
|
protected boolean |
recycle() |
void |
setBytes(byte[] bytes) |
void |
setBytes(byte[] bytes,
int start,
int len) |
void |
skipValue()
跳过属性的值
|
public static final short SIGN_OBJECTB
public static final short SIGN_OBJECTE
public static final byte SIGN_HASNEXT
public static final byte SIGN_NONEXT
public static final byte VERBOSE_NO
public static final byte VERBOSE_YES
protected byte typeval
protected int position
public BsonReader()
public BsonReader(byte[] bytes)
public BsonReader(byte[] bytes, int start, int len)
public static ObjectPool<BsonReader> createPool(int max)
public final void setBytes(byte[] bytes)
public final void setBytes(byte[] bytes, int start, int len)
protected boolean recycle()
public void close()
public final java.lang.String readObjectB(java.lang.Class clazz)
Reader
readObjectB
在类中 Reader
clazz
- 类名public final void readObjectE(java.lang.Class clazz)
Reader
readObjectE
在类中 Reader
clazz
- 类名protected byte currentByte()
public int readMapB(DeMember member, byte[] typevals, Decodeable keyDecoder, Decodeable valueDecoder)
Reader
public int readArrayB(DeMember member, byte[] typevals, Decodeable componentDecoder)
readArrayB
在类中 Reader
member
- DeMembertypevals
- byte[]componentDecoder
- Decodeablepublic final void readArrayE()
Reader
readArrayE
在类中 Reader
public int readMemberContentLength(DeMember member, Decodeable decoder)
Reader
readMemberContentLength
在类中 Reader
member
- DeMemberdecoder
- Decodeablepublic boolean hasNext(int startPosition, int contentLength)
public final DeMember readFieldName(DeMember[] members)
Reader
readFieldName
在类中 Reader
members
- DeMember的全量集合public boolean readBoolean()
Reader
readBoolean
在类中 Reader
public final byte[] readByteArray()
Reader
readByteArray
在类中 Reader
public final float readFloat()
Reader
public final double readDouble()
Reader
readDouble
在类中 Reader
public final java.lang.String readClassName()
Reader
readClassName
在类中 Reader
public java.lang.String readSmallString()
Reader
readSmallString
在类中 Reader
public java.lang.String readString()
Reader
readString
在类中 Reader
public Reader.ValueType readType()
Reader