类 BaseRdbParser
- java.lang.Object
-
- com.moilioncircle.redis.replicator.rdb.BaseRdbParser
-
public class BaseRdbParser extends Object
- 从以下版本开始:
- 2.1.0
- 作者:
- Leon Chen
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classBaseRdbParser.Lenstatic classBaseRdbParser.LenHelperstatic classBaseRdbParser.StringHelper
-
字段概要
字段 修饰符和类型 字段 说明 protected RedisInputStreamin
-
构造器概要
构造器 构造器 说明 BaseRdbParser(RedisInputStream in)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ByteArrayrdbGenericLoadStringObject(int flags)1.|11xxxxxx|xxxxxxxx| remaining 6bit is 0, then an 8 bit integer followsdoublerdbLoadBinaryDoubleValue()floatrdbLoadBinaryFloatValue()doublerdbLoadDoubleValue()ByteArrayrdbLoadEncodedStringObject()ByteArrayrdbLoadIntegerObject(int enctype, int flags)BaseRdbParser.LenrdbLoadLen()read bytes 1 or 2 or 5ByteArrayrdbLoadLzfStringObject(int flags)|11xxxxxx| remaining 6bit is 3,then lzf compressed string followslongrdbLoadMillisecondTime()"expiry time in ms".ByteArrayrdbLoadPlainStringObject()intrdbLoadTime()"expiry time in seconds".
-
-
-
字段详细资料
-
in
protected final RedisInputStream in
-
-
构造器详细资料
-
BaseRdbParser
public BaseRdbParser(RedisInputStream in)
-
-
方法详细资料
-
rdbLoadTime
public int rdbLoadTime() throws IOException"expiry time in seconds". After that, expiry time is read as a 4 byte unsigned int- 返回:
- seconds
- 抛出:
IOException- when read timeout
-
rdbLoadMillisecondTime
public long rdbLoadMillisecondTime() throws IOException"expiry time in ms". After that, expiry time is read as a 8 byte unsigned long- 返回:
- millisecond
- 抛出:
IOException- when read timeout
-
rdbLoadLen
public BaseRdbParser.Len rdbLoadLen() throws IOException
read bytes 1 or 2 or 51. |00xxxxxx| remaining 6 bits represent the length
2. |01xxxxxx|xxxxxxxx| the combined 14 bits represent the length
3. |10xxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx| the remaining 6 bits are discarded.Additional 4 bytes represent the length(big endian in version6)
4. |11xxxxxx| the remaining 6 bits are read.and then the next object is encoded in a special format.so we set encoded = true
- 返回:
- tuple(len, encoded)
- 抛出:
IOException- when read timeout- 另请参阅:
rdbLoadIntegerObject(int, int),rdbLoadLzfStringObject(int)
-
rdbLoadIntegerObject
public ByteArray rdbLoadIntegerObject(int enctype, int flags) throws IOException
- 参数:
enctype- 0,1,2flags- RDB_LOAD_ENC: encoded string.RDB_LOAD_PLAIN | RDB_LOAD_NONE:raw bytes- 返回:
- ByteArray rdb byte array object
- 抛出:
IOException- when read timeout
-
rdbLoadLzfStringObject
public ByteArray rdbLoadLzfStringObject(int flags) throws IOException
|11xxxxxx| remaining 6bit is 3,then lzf compressed string followslzf format
|lzf flag|clen:1 or 2 or 5 bytes|len:1 or 2 or 5 bytes | lzf compressed bytes |
|11xxxxxx|xxxxxxxx|....|xxxxxxxx|xxxxxxxx|....|xxxxxxxx|xxxxxxxx|xxxxxxxx|............xxxxxxxx|
- 参数:
flags- RDB_LOAD_ENC: encoded string.RDB_LOAD_PLAIN | RDB_LOAD_NONE:raw bytes- 返回:
- ByteArray rdb byte array object
- 抛出:
IOException- when read timeout- 另请参阅:
rdbLoadLen()
-
rdbGenericLoadStringObject
public ByteArray rdbGenericLoadStringObject(int flags) throws IOException
1.|11xxxxxx|xxxxxxxx| remaining 6bit is 0, then an 8 bit integer follows2.|11xxxxxx|xxxxxxxx|xxxxxxxx| remaining 6bit is 1, then an 16 bit integer follows
3.|11xxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx| remaining 6bit is 2, then an 32 bit integer follows
4.|11xxxxxx| remaining 6bit is 3,then lzf compressed string follows
- 参数:
flags- RDB_LOAD_ENC: encoded string.RDB_LOAD_PLAIN | RDB_LOAD_NONE:raw bytes- 返回:
- ByteArray rdb byte array object
- 抛出:
IOException- when read timeout- 另请参阅:
rdbLoadIntegerObject(int, int),rdbLoadLzfStringObject(int)
-
rdbLoadPlainStringObject
public ByteArray rdbLoadPlainStringObject() throws IOException
- 返回:
- ByteArray rdb object with byte[]
- 抛出:
IOException- when read timeout
-
rdbLoadEncodedStringObject
public ByteArray rdbLoadEncodedStringObject() throws IOException
- 返回:
- ByteArray rdb object with byte[]
- 抛出:
IOException- when read timeout
-
rdbLoadDoubleValue
public double rdbLoadDoubleValue() throws IOException- 抛出:
IOException
-
rdbLoadBinaryDoubleValue
public double rdbLoadBinaryDoubleValue() throws IOException- 抛出:
IOException
-
rdbLoadBinaryFloatValue
public float rdbLoadBinaryFloatValue() throws IOException- 返回:
- single precision float
- 抛出:
IOException- io exception- 从以下版本开始:
- 2.2.0
-
-