Class SerializingTranscoder
- java.lang.Object
-
- net.rubyeye.xmemcached.transcoders.BaseSerializingTranscoder
-
- net.rubyeye.xmemcached.transcoders.SerializingTranscoder
-
- All Implemented Interfaces:
Transcoder<java.lang.Object>
public class SerializingTranscoder extends BaseSerializingTranscoder implements Transcoder<java.lang.Object>
Transcoder that serializes and compresses objects.
-
-
Field Summary
Fields Modifier and Type Field Description static intCOMPRESSEDprivate intmaxSizeprivate booleanprimitiveAsStringstatic intSERIALIZEDstatic intSPECIAL_BOOLEANstatic intSPECIAL_BYTEstatic intSPECIAL_BYTEARRAYstatic intSPECIAL_DATEstatic intSPECIAL_DOUBLEstatic intSPECIAL_FLOATstatic intSPECIAL_INTstatic intSPECIAL_LONGstatic intSPECIAL_MASKprivate TranscoderUtilstranscoderUtils-
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 SerializingTranscoder()Get a serializing transcoder with the default max data size.SerializingTranscoder(int max)Get a serializing transcoder that specifies the max data size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectdecode(CachedData d)Decode the cached object into the object it represents.protected java.lang.Objectdecode0(CachedData cachedData, byte[] data, int flags)CachedDataencode(java.lang.Object o)Encode the given object for storage.intgetMaxSize()TranscoderUtilsgetTranscoderUtils()booleanisPackZeros()Returns if transcoder packs zero.booleanisPrimitiveAsString()Returns if client stores primitive type as string.voidsetPackZeros(boolean packZeros)Set whether pack zerosvoidsetPrimitiveAsString(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
-
maxSize
private final int maxSize
-
primitiveAsString
private boolean primitiveAsString
-
SERIALIZED
public static final int SERIALIZED
- See Also:
- Constant Field Values
-
COMPRESSED
public static final int COMPRESSED
- See Also:
- Constant Field Values
-
SPECIAL_MASK
public static final int SPECIAL_MASK
- See Also:
- Constant Field Values
-
SPECIAL_BOOLEAN
public static final int SPECIAL_BOOLEAN
- See Also:
- Constant Field Values
-
SPECIAL_INT
public static final int SPECIAL_INT
- See Also:
- Constant Field Values
-
SPECIAL_LONG
public static final int SPECIAL_LONG
- See Also:
- Constant Field Values
-
SPECIAL_DATE
public static final int SPECIAL_DATE
- See Also:
- Constant Field Values
-
SPECIAL_BYTE
public static final int SPECIAL_BYTE
- See Also:
- Constant Field Values
-
SPECIAL_FLOAT
public static final int SPECIAL_FLOAT
- See Also:
- Constant Field Values
-
SPECIAL_DOUBLE
public static final int SPECIAL_DOUBLE
- See Also:
- Constant Field Values
-
SPECIAL_BYTEARRAY
public static final int SPECIAL_BYTEARRAY
- See Also:
- Constant Field Values
-
transcoderUtils
private final TranscoderUtils transcoderUtils
-
-
Method Detail
-
setPackZeros
public void setPackZeros(boolean packZeros)
Description copied from interface:TranscoderSet whether pack zeros- Specified by:
setPackZerosin interfaceTranscoder<java.lang.Object>
-
setPrimitiveAsString
public void setPrimitiveAsString(boolean primitiveAsString)
Description copied from interface:TranscoderSet whether store primitive type as string.- Specified by:
setPrimitiveAsStringin interfaceTranscoder<java.lang.Object>
-
getMaxSize
public final int getMaxSize()
-
getTranscoderUtils
public TranscoderUtils getTranscoderUtils()
-
isPackZeros
public boolean isPackZeros()
Description copied from interface:TranscoderReturns if transcoder packs zero.- Specified by:
isPackZerosin interfaceTranscoder<java.lang.Object>- Returns:
-
isPrimitiveAsString
public boolean isPrimitiveAsString()
Description copied from interface:TranscoderReturns if client stores primitive type as string.- Specified by:
isPrimitiveAsStringin interfaceTranscoder<java.lang.Object>- Returns:
-
decode
public final java.lang.Object decode(CachedData d)
Description copied from interface:TranscoderDecode the cached object into the object it represents.- Specified by:
decodein interfaceTranscoder<java.lang.Object>- Parameters:
d- the data- Returns:
- the return value
-
decode0
protected final java.lang.Object decode0(CachedData cachedData, byte[] data, int flags)
-
encode
public final CachedData encode(java.lang.Object o)
Description copied from interface:TranscoderEncode the given object for storage.- Specified by:
encodein interfaceTranscoder<java.lang.Object>- Parameters:
o- the object- Returns:
- the CachedData representing what should be sent
-
-