public Object encodeValue(Object value) throws CodecException {
if (value != null) {
if (value instanceof MemcachedValue) {
return value;
} else if (value instanceof byte[]) {
return new MemcachedValue((byte[])value, 1, 0);
} else if (value instanceof String) {
return new MemcachedValue(((String)value).getBytes(UTF8), 1, 0);
} else {
throw log.valueEncodingFailed(value.getClass().getName(), this.getName());
}
} else {
return null;