本文整理汇总了Java中com.google.ipc.invalidation.ticl.PersistenceUtils.deserializeState方法的典型用法代码示例。如果您正苦于以下问题:Java PersistenceUtils.deserializeState方法的具体用法?Java PersistenceUtils.deserializeState怎么用?Java PersistenceUtils.deserializeState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.ipc.invalidation.ticl.PersistenceUtils
的用法示例。
在下文中一共展示了PersistenceUtils.deserializeState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeTiclState
import com.google.ipc.invalidation.ticl.PersistenceUtils; //导入方法依赖的package包/类
/**
* Returns the persisted state for the client with key {@code clientKey} in
* {@code storageForClient}, or {@code null} if no valid state could be found.
* <p>
* REQUIRES: {@code storageForClient}.load() has been called successfully.
*/
PersistentTiclState decodeTiclState(final String clientKey, AndroidStorage storageForClient) {
synchronized (lock) {
// Retrieve the serialized state.
final Map<String, byte[]> properties = storageForClient.getPropertiesUnsafe();
byte[] clientStateBytes = TypedUtil.mapGet(properties,
InvalidationClientCore.CLIENT_TOKEN_KEY);
if (clientStateBytes == null) {
logger.warning("No client state found in storage for %s: %s", clientKey,
properties.keySet());
return null;
}
// Deserialize it.
PersistentTiclState clientState =
PersistenceUtils.deserializeState(logger, clientStateBytes, digestFn);
if (clientState == null) {
logger.warning("Invalid client state found in storage for %s", clientKey);
return null;
}
return clientState;
}
}