Constructor and Description |
---|
IntegerCodec() |
Modifier and Type | Method and Description |
---|---|
static long |
readLong(CodecDataInput cdi)
Decode as signed long, assuming encoder flips signed bit for memory comparable
|
static long |
readULong(CodecDataInput cdi)
Decode as unsigned long without any binary manipulation
|
static long |
readUVarLong(CodecDataInput cdi)
Decode as var-length unsigned long, the same as go's binary.Uvarint
|
static long |
readVarLong(CodecDataInput cdi)
Decode as var-length long, the same as go's binary.Varint
|
static void |
writeDuration(CodecDataOutput cdo,
long value)
Encode Data as duration, the same as go's binary.PutUvarint
|
static void |
writeLong(CodecDataOutput cdo,
long lVal)
Encode long value without type flag at the beginning The signed bit is flipped for memory
comparable purpose
|
static void |
writeLongFully(CodecDataOutput cdo,
long lVal,
boolean comparable)
Encoding a long value to byte buffer with type flag at the beginning If we are encoding a
key, the comparable is must true; otherwise the comparable is false.
|
static void |
writeULong(CodecDataOutput cdo,
long lVal)
Encode long value without type flag at the beginning
|
static void |
writeULongFully(CodecDataOutput cdo,
long lVal,
boolean comparable)
Encoding a unsigned long value to byte buffer with type flag at the beginning
|
public static void writeLongFully(CodecDataOutput cdo, long lVal, boolean comparable)
cdo
- For outputting data in bytes arraylVal
- The data to encodecomparable
- If the output should be memory comparable without decoding. In real TiDB
use case, if used in Key encoding, we output memory comparable format otherwise notpublic static void writeULongFully(CodecDataOutput cdo, long lVal, boolean comparable)
cdo
- For outputting data in bytes arraylVal
- The data to encode, note that long is treated as unsignedcomparable
- If the output should be memory comparable without decoding. In real TiDB
use case, if used in Key encoding, we output memory comparable format otherwise notpublic static void writeDuration(CodecDataOutput cdo, long value)
cdo
- For outputting data in bytes arrayvalue
- The data to encodepublic static void writeLong(CodecDataOutput cdo, long lVal)
cdo
- For outputting data in bytes arraylVal
- The data to encodepublic static void writeULong(CodecDataOutput cdo, long lVal)
cdo
- For outputting data in bytes arraylVal
- The data to encodepublic static long readLong(CodecDataInput cdi)
cdi
- source of datapublic static long readULong(CodecDataInput cdi)
cdi
- source of datapublic static long readVarLong(CodecDataInput cdi)
cdi
- source of datapublic static long readUVarLong(CodecDataInput cdi)
cdi
- source of dataCopyright © 2024 PingCAP. All rights reserved.