public class ByteArrayCodec extends Object implements RedisCodec<byte[],byte[]>, ToByteBufEncoder<byte[],byte[]>
RedisCodec
that uses plain byte arrays without further transformations.Modifier and Type | Field and Description |
---|---|
static ByteArrayCodec |
INSTANCE |
Constructor and Description |
---|
ByteArrayCodec() |
Modifier and Type | Method and Description |
---|---|
byte[] |
decodeKey(ByteBuffer bytes)
Decode the key output by redis.
|
byte[] |
decodeValue(ByteBuffer bytes)
Decode the value output by redis.
|
ByteBuffer |
encodeKey(byte[] key)
Encode the key for output to redis.
|
void |
encodeKey(byte[] key,
ByteBuf target)
Encode the key for output to redis.
|
ByteBuffer |
encodeValue(byte[] value)
Encode the value for output to redis.
|
void |
encodeValue(byte[] value,
ByteBuf target)
Encode the value for output to redis.
|
int |
estimateSize(Object keyOrValue)
Estimates the size of the resulting byte stream.
|
boolean |
isEstimateExact()
Returns
true if ToByteBufEncoder.estimateSize(Object) returns exact size This is used as an optimization to reduce memory
allocations when encoding data. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
of
public static final ByteArrayCodec INSTANCE
public void encodeKey(byte[] key, ByteBuf target)
ToByteBufEncoder
encodeKey
in interface ToByteBufEncoder<byte[],byte[]>
key
- the key, may be null
.target
- the target buffer, must not be null
.public void encodeValue(byte[] value, ByteBuf target)
ToByteBufEncoder
encodeValue
in interface ToByteBufEncoder<byte[],byte[]>
value
- the value, may be null
.target
- the target buffer, must not be null
.public int estimateSize(Object keyOrValue)
ToByteBufEncoder
estimateSize
in interface ToByteBufEncoder<byte[],byte[]>
keyOrValue
- the key or value, may be null
.public boolean isEstimateExact()
ToByteBufEncoder
true
if ToByteBufEncoder.estimateSize(Object)
returns exact size This is used as an optimization to reduce memory
allocations when encoding data.isEstimateExact
in interface ToByteBufEncoder<byte[],byte[]>
true
if ToByteBufEncoder.estimateSize(Object)
returns exact size.public byte[] decodeKey(ByteBuffer bytes)
RedisCodec
decodeKey
in interface RedisCodec<byte[],byte[]>
bytes
- Raw bytes of the key, must not be null
.null
.public byte[] decodeValue(ByteBuffer bytes)
RedisCodec
decodeValue
in interface RedisCodec<byte[],byte[]>
bytes
- Raw bytes of the value, must not be null
.null
.public ByteBuffer encodeKey(byte[] key)
RedisCodec
encodeKey
in interface RedisCodec<byte[],byte[]>
key
- the key, may be null
.null
.public ByteBuffer encodeValue(byte[] value)
RedisCodec
encodeValue
in interface RedisCodec<byte[],byte[]>
value
- the value, may be null
.null
.Copyright © 2024 lettuce.io. All rights reserved.