Created
May 12, 2017 06:58
-
-
Save mp911de/a94866d95de613b73c76100e1be86852 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.nio.ByteBuffer; | |
| import com.lambdaworks.redis.codec.ByteArrayCodec; | |
| import com.lambdaworks.redis.codec.RedisCodec; | |
| import com.lambdaworks.redis.codec.StringCodec; | |
| /** | |
| * @author Mark Paluch | |
| */ | |
| class StringByteRedisCodec implements RedisCodec<String, byte[]> { | |
| public String decodeKey(ByteBuffer byteBuffer) { | |
| return StringCodec.UTF8.decodeKey(byteBuffer); | |
| } | |
| public byte[] decodeValue(ByteBuffer byteBuffer) { | |
| return ByteArrayCodec.INSTANCE.decodeValue(byteBuffer); | |
| } | |
| public ByteBuffer encodeKey(String s) { | |
| return StringCodec.UTF8.encodeKey(s); | |
| } | |
| public ByteBuffer encodeValue(byte[] bytes) { | |
| return ByteArrayCodec.INSTANCE.encodeValue(bytes); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment