This commit is contained in:
地平线
2015-06-29 09:21:24 +08:00
parent f597036ebb
commit dc08931d6d

View File

@@ -12,17 +12,18 @@ import java.lang.reflect.*;
/**
* BSON协议格式:
* 1). 基本数据类型: 直接转换成byte[]
* 2). String: smallstring(无特殊字符且长度小于256的字符串): length(1 byte) + byte[](utf8); 其他字符串: length(4 bytes) + byte[](utf8);
* 3). 数组(长度不能大于65535): length(2 byte) + byte[]...
* 4). Object:
* 1. realclass (smallstring) (如果指定格式化的class与实体对象的class不一致才会有该值)
* 2. 空字符串(smallstring)
* 2). SmallString(无特殊字符且长度小于256的字符串): length(1 byte) + byte[](utf8); 通常用于类名、字段名、枚举。
* 3). String: length(4 bytes) + byte[](utf8);
* 4). 数组(长度不能大于65535): length(2 byte) + byte[]...
* 5). Object:
* 1. realclass (SmallString) (如果指定格式化的class与实体对象的class不一致才会有该值)
* 2. 空字符串(SmallString)
* 3. SIGN_OBJECTB 标记位值固定为0xBB (short)
* 4. 循环字段值:
* 4.1 SIGN_HASNEXT 标记位值固定为1 (byte)
* 4.2 字段类型; 1-9为基本类型&字符串; 101-109为基本类型&字符串的数组; 127为object
* 4.3 字段名 (smallstring)
* 4.4 字段的值object
* 4.2 字段类型; 1-9为基本类型&字符串; 101-109为基本类型&字符串的数组; 127为Object
* 4.3 字段名 (SmallString)
* 4.4 字段的值Object
* 5. SIGN_NONEXT 标记位值固定为0 (byte)
* 6. SIGN_OBJECTE 标记位值固定为0xEE (short)
*