public class MemcacheSerializationStatic serialization helpers used by MemcacheServiceImpl
This class is thread-safe.
Static Fields
USE_THREAD_CONTEXT_CLASSLOADER_PROPERTY
public static final String USE_THREAD_CONTEXT_CLASSLOADER_PROPERTY| Field Value | |
|---|---|
| Type | Description |
String |
|
Static Methods
deserialize(byte[] value, int flags)
public static Object deserialize(byte[] value, int flags)Deserialize the object, according to its flags. This would have private visibility, but is also used by LocalMemcacheService for the increment operation.
| Parameters | |
|---|---|
| Name | Description |
value |
byte[] |
flags |
int |
| Returns | |
|---|---|
| Type | Description |
Object |
the Object originally stored |
| Exceptions | |
|---|---|
| Type | Description |
ClassNotFoundException |
if the object can't be re-instantiated due to being an unlocatable type |
IOException |
if the object can't be re-instantiated due to being an unlocatable type |
makePbKey(Object key)
public static byte[] makePbKey(Object key)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.
| Parameter | |
|---|---|
| Name | Description |
key |
Object |
| Returns | |
|---|---|
| Type | Description |
byte[] |
hash result. For the key |
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
serialize(Object value)
public static MemcacheSerialization.ValueAndFlags serialize(Object value)| Parameter | |
|---|---|
| Name | Description |
value |
Object |
| Returns | |
|---|---|
| Type | Description |
MemcacheSerialization.ValueAndFlags |
the ValueAndFlags containing a serialized representation of the Object and the flags to hint deserialization. |
| Exceptions | |
|---|---|
| Type | Description |
IOException |
for serialization errors, normally due to a non-serializable object type |