java.lang.Object
io.lettuce.core.codec.ByteArrayCodec
- All Implemented Interfaces:
RedisCodec<byte[],byte[]>,ToByteBufEncoder<byte[],byte[]>
public class ByteArrayCodec extends Object implements RedisCodec<byte[],byte[]>, ToByteBufEncoder<byte[],byte[]>
A
RedisCodec that uses plain byte arrays without further transformations.- Since:
- 3.3
- Author:
- Mark Paluch
-
Field Summary
Fields Modifier and Type Field Description static ByteArrayCodecINSTANCE -
Constructor Summary
Constructors Constructor Description ByteArrayCodec() -
Method Summary
Modifier and Type Method Description byte[]decodeKey(ByteBuffer bytes)Decode the key output by redis.byte[]decodeValue(ByteBuffer bytes)Decode the value output by redis.ByteBufferencodeKey(byte[] key)Encode the key for output to redis.voidencodeKey(byte[] key, ByteBuf target)Encode the key for output to redis.ByteBufferencodeValue(byte[] value)Encode the value for output to redis.voidencodeValue(byte[] value, ByteBuf target)Encode the value for output to redis.intestimateSize(Object keyOrValue)Estimates the size of the resulting byte stream.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
ByteArrayCodec
public ByteArrayCodec()
-
-
Method Details
-
encodeKey
Description copied from interface:ToByteBufEncoderEncode the key for output to redis.- Specified by:
encodeKeyin interfaceToByteBufEncoder<byte[],byte[]>- Parameters:
key- the key, may benull.target- the target buffer, must not benull.
-
encodeValue
Description copied from interface:ToByteBufEncoderEncode the value for output to redis.- Specified by:
encodeValuein interfaceToByteBufEncoder<byte[],byte[]>- Parameters:
value- the value, may benull.target- the target buffer, must not benull.
-
estimateSize
Description copied from interface:ToByteBufEncoderEstimates the size of the resulting byte stream. This method is called for keys and values to estimate the size for the temporary buffer to allocate.- Specified by:
estimateSizein interfaceToByteBufEncoder<byte[],byte[]>- Parameters:
keyOrValue- the key or value, may benull.- Returns:
- the estimated number of bytes in the encoded representation.
-
decodeKey
Description copied from interface:RedisCodecDecode the key output by redis.- Specified by:
decodeKeyin interfaceRedisCodec<byte[],byte[]>- Parameters:
bytes- Raw bytes of the key, must not benull.- Returns:
- The decoded key, may be
null.
-
decodeValue
Description copied from interface:RedisCodecDecode the value output by redis.- Specified by:
decodeValuein interfaceRedisCodec<byte[],byte[]>- Parameters:
bytes- Raw bytes of the value, must not benull.- Returns:
- The decoded value, may be
null.
-
encodeKey
Description copied from interface:RedisCodecEncode the key for output to redis.- Specified by:
encodeKeyin interfaceRedisCodec<byte[],byte[]>- Parameters:
key- the key, may benull.- Returns:
- The encoded key, never
null.
-
encodeValue
Description copied from interface:RedisCodecEncode the value for output to redis.- Specified by:
encodeValuein interfaceRedisCodec<byte[],byte[]>- Parameters:
value- the value, may benull.- Returns:
- The encoded value, never
null.
-