com.lambdaworks.redis.codec
Class Utf8StringCodec

java.lang.Object
  extended by com.lambdaworks.redis.codec.RedisCodec<String,String>
      extended by com.lambdaworks.redis.codec.Utf8StringCodec

public class Utf8StringCodec
extends RedisCodec<String,String>

A RedisCodec that handles UTF-8 encoded keys and values.

Author:
Will Glozer

Constructor Summary
Utf8StringCodec()
          Initialize a new instance that encodes and decodes strings using the UTF-8 charset;
 
Method Summary
 String decodeKey(ByteBuffer bytes)
          Decode the key output by redis.
 String decodeValue(ByteBuffer bytes)
          Decode the value output by redis.
 byte[] encodeKey(String key)
          Encode the key for output to redis.
 byte[] encodeValue(String value)
          Encode the value for output to redis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utf8StringCodec

public Utf8StringCodec()
Initialize a new instance that encodes and decodes strings using the UTF-8 charset;

Method Detail

decodeKey

public String decodeKey(ByteBuffer bytes)
Description copied from class: RedisCodec
Decode the key output by redis.

Specified by:
decodeKey in class RedisCodec<String,String>
Parameters:
bytes - Raw bytes of the key.
Returns:
The decoded key.

decodeValue

public String decodeValue(ByteBuffer bytes)
Description copied from class: RedisCodec
Decode the value output by redis.

Specified by:
decodeValue in class RedisCodec<String,String>
Parameters:
bytes - Raw bytes of the value.
Returns:
The decoded value.

encodeKey

public byte[] encodeKey(String key)
Description copied from class: RedisCodec
Encode the key for output to redis.

Specified by:
encodeKey in class RedisCodec<String,String>
Parameters:
key - Key.
Returns:
The encoded key.

encodeValue

public byte[] encodeValue(String value)
Description copied from class: RedisCodec
Encode the value for output to redis.

Specified by:
encodeValue in class RedisCodec<String,String>
Parameters:
value - Value.
Returns:
The encoded value.


Copyright © 2013. All Rights Reserved.