Class WhalinV1Transcoder
- java.lang.Object
-
- net.rubyeye.xmemcached.transcoders.BaseSerializingTranscoder
-
- net.rubyeye.xmemcached.transcoders.WhalinV1Transcoder
-
- All Implemented Interfaces:
Transcoder<java.lang.Object>
public class WhalinV1Transcoder extends BaseSerializingTranscoder implements Transcoder<java.lang.Object>
Handles old whalin (tested with v1.6) encoding: data type is in the first byte of the value.- Since:
- Oct 16, 2008
-
-
Field Summary
Fields Modifier and Type Field Description static int
COMPRESSED
static int
SERIALIZED
static int
SPECIAL_BOOLEAN
static int
SPECIAL_BYTE
static int
SPECIAL_CHARACTER
static int
SPECIAL_DATE
static int
SPECIAL_DOUBLE
static int
SPECIAL_FLOAT
static int
SPECIAL_INTEGER
static int
SPECIAL_LONG
static int
SPECIAL_SHORT
static int
SPECIAL_STRING
static int
SPECIAL_STRINGBUFFER
static int
SPECIAL_STRINGBUILDER
-
Fields inherited from class net.rubyeye.xmemcached.transcoders.BaseSerializingTranscoder
charset, COMPRESS_RATIO, compressionThreshold, compressMode, DEFAULT_CHARSET, DEFAULT_COMPRESSION_THRESHOLD, log
-
-
Constructor Summary
Constructors Constructor Description WhalinV1Transcoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
decode(CachedData d)
Decode the cached object into the object it represents.private java.lang.Boolean
decodeBoolean(byte[] in)
private java.lang.Byte
decodeByte(byte[] in)
private java.lang.Character
decodeCharacter(byte[] b)
private java.lang.Double
decodeDouble(byte[] in)
private java.lang.Float
decodeFloat(byte[] in)
private java.lang.Integer
decodeInteger(byte[] in)
private java.lang.Long
decodeLong(byte[] in)
private java.lang.Short
decodeShort(byte[] data)
private java.lang.String
decodeW1String(byte[] b)
CachedData
encode(java.lang.Object o)
Encode the given object for storage.private byte[]
encodeBoolean(java.lang.Boolean value)
private byte[]
encodeByte(java.lang.Byte value)
private byte[]
encodeCharacter(java.lang.Character value)
private byte[]
encodeDouble(java.lang.Double value)
private byte[]
encodeFloat(java.lang.Float value)
private byte[]
encodeInteger(java.lang.Integer value)
private byte[]
encodeLong(java.lang.Long value)
private byte[]
encodeLong(java.lang.Long value, int type)
private byte[]
encodeNum(long l, int maxBytes)
private byte[]
encodeShort(java.lang.Short value)
private byte[]
encodeStringBuffer(java.lang.StringBuffer value)
private byte[]
encodeStringbuilder(java.lang.StringBuilder value)
private byte[]
encodeW1String(java.lang.String value)
boolean
isPackZeros()
Returns if transcoder packs zero.boolean
isPrimitiveAsString()
Returns if client stores primitive type as string.void
setPackZeros(boolean packZeros)
Set whether pack zerosvoid
setPrimitiveAsString(boolean primitiveAsString)
Set whether store primitive type as string.-
Methods inherited from class net.rubyeye.xmemcached.transcoders.BaseSerializingTranscoder
compress, decodeString, decompress, deserialize, encodeString, getCompressMode, serialize, setCharset, setCompressionMode, setCompressionThreshold
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.rubyeye.xmemcached.transcoders.Transcoder
setCompressionMode, setCompressionThreshold
-
-
-
-
Field Detail
-
SPECIAL_BYTE
public static final int SPECIAL_BYTE
- See Also:
- Constant Field Values
-
SPECIAL_BOOLEAN
public static final int SPECIAL_BOOLEAN
- See Also:
- Constant Field Values
-
SPECIAL_INTEGER
public static final int SPECIAL_INTEGER
- See Also:
- Constant Field Values
-
SPECIAL_LONG
public static final int SPECIAL_LONG
- See Also:
- Constant Field Values
-
SPECIAL_CHARACTER
public static final int SPECIAL_CHARACTER
- See Also:
- Constant Field Values
-
SPECIAL_STRING
public static final int SPECIAL_STRING
- See Also:
- Constant Field Values
-
SPECIAL_STRINGBUFFER
public static final int SPECIAL_STRINGBUFFER
- See Also:
- Constant Field Values
-
SPECIAL_FLOAT
public static final int SPECIAL_FLOAT
- See Also:
- Constant Field Values
-
SPECIAL_SHORT
public static final int SPECIAL_SHORT
- See Also:
- Constant Field Values
-
SPECIAL_DOUBLE
public static final int SPECIAL_DOUBLE
- See Also:
- Constant Field Values
-
SPECIAL_DATE
public static final int SPECIAL_DATE
- See Also:
- Constant Field Values
-
SPECIAL_STRINGBUILDER
public static final int SPECIAL_STRINGBUILDER
- See Also:
- Constant Field Values
-
COMPRESSED
public static final int COMPRESSED
- See Also:
- Constant Field Values
-
SERIALIZED
public static final int SERIALIZED
- See Also:
- Constant Field Values
-
-
Method Detail
-
setPackZeros
public void setPackZeros(boolean packZeros)
Description copied from interface:Transcoder
Set whether pack zeros- Specified by:
setPackZeros
in interfaceTranscoder<java.lang.Object>
-
setPrimitiveAsString
public void setPrimitiveAsString(boolean primitiveAsString)
Description copied from interface:Transcoder
Set whether store primitive type as string.- Specified by:
setPrimitiveAsString
in interfaceTranscoder<java.lang.Object>
-
isPackZeros
public boolean isPackZeros()
Description copied from interface:Transcoder
Returns if transcoder packs zero.- Specified by:
isPackZeros
in interfaceTranscoder<java.lang.Object>
- Returns:
-
isPrimitiveAsString
public boolean isPrimitiveAsString()
Description copied from interface:Transcoder
Returns if client stores primitive type as string.- Specified by:
isPrimitiveAsString
in interfaceTranscoder<java.lang.Object>
- Returns:
-
encode
public CachedData encode(java.lang.Object o)
Description copied from interface:Transcoder
Encode the given object for storage.- Specified by:
encode
in interfaceTranscoder<java.lang.Object>
- Parameters:
o
- the object- Returns:
- the CachedData representing what should be sent
-
decode
public java.lang.Object decode(CachedData d)
Description copied from interface:Transcoder
Decode the cached object into the object it represents.- Specified by:
decode
in interfaceTranscoder<java.lang.Object>
- Parameters:
d
- the data- Returns:
- the return value
-
decodeShort
private java.lang.Short decodeShort(byte[] data)
-
decodeByte
private java.lang.Byte decodeByte(byte[] in)
-
decodeInteger
private java.lang.Integer decodeInteger(byte[] in)
-
decodeFloat
private java.lang.Float decodeFloat(byte[] in)
-
decodeDouble
private java.lang.Double decodeDouble(byte[] in)
-
decodeBoolean
private java.lang.Boolean decodeBoolean(byte[] in)
-
decodeLong
private java.lang.Long decodeLong(byte[] in)
-
decodeCharacter
private java.lang.Character decodeCharacter(byte[] b)
-
decodeW1String
private java.lang.String decodeW1String(byte[] b)
-
encodeByte
private byte[] encodeByte(java.lang.Byte value)
-
encodeBoolean
private byte[] encodeBoolean(java.lang.Boolean value)
-
encodeInteger
private byte[] encodeInteger(java.lang.Integer value)
-
encodeLong
private byte[] encodeLong(java.lang.Long value, int type)
-
encodeLong
private byte[] encodeLong(java.lang.Long value)
-
encodeShort
private byte[] encodeShort(java.lang.Short value)
-
encodeFloat
private byte[] encodeFloat(java.lang.Float value)
-
encodeDouble
private byte[] encodeDouble(java.lang.Double value)
-
encodeCharacter
private byte[] encodeCharacter(java.lang.Character value)
-
encodeStringBuffer
private byte[] encodeStringBuffer(java.lang.StringBuffer value)
-
encodeStringbuilder
private byte[] encodeStringbuilder(java.lang.StringBuilder value)
-
encodeW1String
private byte[] encodeW1String(java.lang.String value)
-
encodeNum
private byte[] encodeNum(long l, int maxBytes)
-
-