Deserialize the object, according to its flags. This would have private
visibility, but is also used by LocalMemcacheService for the increment
operation.
if the object can't be re-instantiated due
to being an unlocatable type
makePbKey(Object key)
publicstaticbyte[]makePbKey(Objectkey)
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eMemcacheSerialization\u003c/code\u003e provides static helpers for serialization used by \u003ccode\u003eMemcacheServiceImpl\u003c/code\u003e, and it is thread-safe.\u003c/p\u003e\n"],["\u003cp\u003eIt inherits from \u003ccode\u003eObject\u003c/code\u003e and includes inherited members such as \u003ccode\u003eclone()\u003c/code\u003e, \u003ccode\u003eequals(Object)\u003c/code\u003e, and \u003ccode\u003etoString()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003edeserialize(byte[] value, int flags)\u003c/code\u003e method reconstructs an object from its serialized form based on flags, and it may throw \u003ccode\u003eClassNotFoundException\u003c/code\u003e or \u003ccode\u003eIOException\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003emakePbKey(Object key)\u003c/code\u003e converts a user-provided key into a byte array, employing a SHA1 hash for non-basic types, and it also returns null for a null key.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eserialize(Object value)\u003c/code\u003e method converts any given object into its serialized form, returning a \u003ccode\u003eValueAndFlags\u003c/code\u003e containing the object's representation and deserialization hints, and it may throw \u003ccode\u003eIOException\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Class MemcacheSerialization (2.0.0)\n\n public class MemcacheSerialization\n\nStatic serialization helpers used by MemcacheServiceImpl\n\nThis class is thread-safe. \n\nInheritance\n-----------\n\n[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e MemcacheSerialization \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Fields\n-------------\n\n### USE_THREAD_CONTEXT_CLASSLOADER_PROPERTY\n\n public static final String USE_THREAD_CONTEXT_CLASSLOADER_PROPERTY\n\nStatic Methods\n--------------\n\n### deserialize(byte\\[\\] value, int flags)\n\n public static Object deserialize(byte[] value, int flags)\n\nDeserialize the object, according to its flags. This would have private\nvisibility, but is also used by LocalMemcacheService for the increment\noperation.\n\n### makePbKey(Object key)\n\n public static byte[] makePbKey(Object key)\n\nConverts the user's key Object into a byte\\[\\] for the MemcacheGetRequest.\nBecause the underlying service has a length limit, we actually use the\nSHA1 hash of the serialized object as its key if it's not a basic type.\nFor the basic types (that is, `String`, `Boolean`, and the\nfixed-point numbers), we use a human-readable representation.\n\n### serialize(Object value)\n\n public static MemcacheSerialization.ValueAndFlags serialize(Object value)"]]