Class MemcacheSerialization
java.lang.Object
com.google.appengine.api.memcache.MemcacheSerialization
Static serialization helpers used by
MemcacheServiceImpl
This class is thread-safe.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumValues used as flags on the MemcacheService's values.static classTuple of a serialized byte array value and associated flags to interpret that value. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Objectdeserialize(byte[] value, int flags) Deserialize the object, according to its flags.static byte[]Converts the user's key Object into a byte[] for the MemcacheGetRequest.
-
Field Details
-
USE_THREAD_CONTEXT_CLASSLOADER_PROPERTY
- See Also:
-
-
Method Details
-
deserialize
public static Object deserialize(byte[] value, int flags) throws ClassNotFoundException, IOException Deserialize the object, according to its flags. This would have private visibility, but is also used by LocalMemcacheService for the increment operation.- Parameters:
value-flags-- Returns:
- the Object originally stored
- Throws:
ClassNotFoundException- if the object can't be re-instantiated due to being an unlocatable typeIOException- if the object can't be re-instantiated for some other reason
-
makePbKey
Converts the user's key Object into a byte[] for the MemcacheGetRequest. Because the underlying service has a length limit, we actually use the SHA1 hash of the serialized object as its key if it's not a basic type. For the basic types (that is,String,Boolean, and the fixed-point numbers), we use a human-readable representation.- Parameters:
key-- Returns:
- hash result. For the key
null, the hash is alsonull. - Throws:
IOException
-
serialize
- Parameters:
value-- Returns:
- the ValueAndFlags containing a serialized representation of the Object and the flags to hint deserialization.
- Throws:
IOException- for serialization errors, normally due to a non-serializable object type
-