public class BaseRdbParser extends Object
限定符和类型 | 类 | 说明 |
---|---|---|
static class |
BaseRdbParser.Len |
|
static class |
BaseRdbParser.LenHelper |
|
static class |
BaseRdbParser.StringHelper |
限定符和类型 | 字段 | 说明 |
---|---|---|
protected RedisInputStream |
in |
构造器 | 说明 |
---|---|
BaseRdbParser(RedisInputStream in) |
限定符和类型 | 方法 | 说明 |
---|---|---|
ByteArray |
rdbGenericLoadStringObject(int flags) |
1.|11xxxxxx|xxxxxxxx| remaining 6bit is 0, then an 8 bit integer follows
|
double |
rdbLoadBinaryDoubleValue() |
|
float |
rdbLoadBinaryFloatValue() |
|
double |
rdbLoadDoubleValue() |
|
ByteArray |
rdbLoadEncodedStringObject() |
|
ByteArray |
rdbLoadIntegerObject(int enctype,
int flags) |
|
BaseRdbParser.Len |
rdbLoadLen() |
read bytes 1 or 2 or 5
|
ByteArray |
rdbLoadLzfStringObject(int flags) |
|11xxxxxx| remaining 6bit is 3,then lzf compressed string follows
|
long |
rdbLoadMillisecondTime() |
"expiry time in ms".
|
ByteArray |
rdbLoadPlainStringObject() |
|
int |
rdbLoadTime() |
"expiry time in seconds".
|
protected final RedisInputStream in
public BaseRdbParser(RedisInputStream in)
public int rdbLoadTime() throws IOException
IOException
- when read timeoutpublic long rdbLoadMillisecondTime() throws IOException
IOException
- when read timeoutpublic BaseRdbParser.Len rdbLoadLen() throws IOException
1. |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
IOException
- when read timeoutrdbLoadIntegerObject(int, int)
,
rdbLoadLzfStringObject(int)
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 bytesIOException
- when read timeoutpublic ByteArray rdbLoadLzfStringObject(int flags) throws IOException
lzf 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 bytesIOException
- when read timeoutrdbLoadLen()
public ByteArray rdbGenericLoadStringObject(int flags) throws IOException
2.|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 bytesIOException
- when read timeoutrdbLoadIntegerObject(int, int)
,
rdbLoadLzfStringObject(int)
public ByteArray rdbLoadPlainStringObject() throws IOException
IOException
- when read timeoutpublic ByteArray rdbLoadEncodedStringObject() throws IOException
IOException
- when read timeoutpublic double rdbLoadDoubleValue() throws IOException
IOException
public double rdbLoadBinaryDoubleValue() throws IOException
IOException
public float rdbLoadBinaryFloatValue() throws IOException
IOException
- io exceptionCopyright © 2019. All rights reserved.