本文整理汇总了Java中com.google.ipc.invalidation.common.DigestFunction类的典型用法代码示例。如果您正苦于以下问题:Java DigestFunction类的具体用法?Java DigestFunction怎么用?Java DigestFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DigestFunction类属于com.google.ipc.invalidation.common包,在下文中一共展示了DigestFunction类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deserializeState
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
/**
* Deserializes a Ticl state blob. Returns either the parsed state or {@code null}
* if it could not be parsed.
*/
public static PersistentTiclState deserializeState(Logger logger, byte[] stateBlobBytes,
DigestFunction digestFn) {
PersistentStateBlob stateBlob;
try {
// Try parsing the envelope protocol buffer.
stateBlob = PersistentStateBlob.parseFrom(stateBlobBytes);
} catch (ValidationException exception) {
logger.severe("Failed deserializing Ticl state: %s", exception.getMessage());
return null;
}
// Check the mac in the envelope against the recomputed mac from the state.
PersistentTiclState ticlState = stateBlob.getTiclState();
Bytes mac = generateMac(ticlState, digestFn);
if (!TypedUtil.<Bytes>equals(mac, stateBlob.getAuthenticationCode())) {
logger.warning("Ticl state failed MAC check: computed %s vs %s", mac,
stateBlob.getAuthenticationCode());
return null;
}
return ticlState;
}
开发者ID:mogoweb,项目名称:365browser,代码行数:26,代码来源:PersistenceUtils.java
示例2: RegistrationManager
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
public RegistrationManager(Logger logger, Statistics statistics, DigestFunction digestFn,
RegistrationManagerStateP registrationManagerState) {
this.logger = logger;
this.statistics = statistics;
this.desiredRegistrations = new SimpleRegistrationStore(digestFn);
if (registrationManagerState == null) {
// Initialize the server summary with a 0 size and the digest corresponding
// to it. Using defaultInstance would wrong since the server digest will
// not match unnecessarily and result in an info message being sent.
this.lastKnownServerSummary = getRegistrationSummary();
} else {
this.lastKnownServerSummary = registrationManagerState.getNullableLastKnownServerSummary();
if (this.lastKnownServerSummary == null) {
// If no server summary is set, use a default with size 0.
this.lastKnownServerSummary = getRegistrationSummary();
}
desiredRegistrations.add(registrationManagerState.getRegistrations());
for (RegistrationP regOp : registrationManagerState.getPendingOperations()) {
pendingOperations.put(regOp.getObjectId(), regOp.getOpType());
}
}
}
开发者ID:mogoweb,项目名称:365browser,代码行数:24,代码来源:RegistrationManager.java
示例3: deserializeState
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
/**
* Deserializes a Ticl state blob. Returns either the parsed state or {@code null}
* if it could not be parsed.
*/
public static PersistentTiclState deserializeState(Logger logger, byte[] stateBlobBytes,
DigestFunction digestFn) {
PersistentStateBlob stateBlob;
try {
// Try parsing the envelope protocol buffer.
stateBlob = PersistentStateBlob.parseFrom(stateBlobBytes);
} catch (InvalidProtocolBufferException exception) {
logger.severe("Failed deserializing Ticl state: %s", exception.getMessage());
return null;
}
// Check the mac in the envelope against the recomputed mac from the state.
PersistentTiclState ticlState = stateBlob.getTiclState();
ByteString mac = generateMac(ticlState, digestFn);
if (!TypedUtil.<ByteString>equals(mac, stateBlob.getAuthenticationCode())) {
logger.warning("Ticl state failed MAC check: computed %s vs %s", mac,
stateBlob.getAuthenticationCode());
return null;
}
return ticlState;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:26,代码来源:PersistenceUtils.java
示例4: RegistrationManager
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
public RegistrationManager(Logger logger, Statistics statistics, DigestFunction digestFn,
RegistrationManagerStateP registrationManagerState) {
this.logger = logger;
this.statistics = statistics;
this.desiredRegistrations = new SimpleRegistrationStore(digestFn);
if (registrationManagerState == null) {
// Initialize the server summary with a 0 size and the digest corresponding
// to it. Using defaultInstance would wrong since the server digest will
// not match unnecessarily and result in an info message being sent.
this.lastKnownServerSummary = ProtoWrapper.of(getRegistrationSummary());
} else {
this.lastKnownServerSummary =
ProtoWrapper.of(registrationManagerState.getLastKnownServerSummary());
desiredRegistrations.add(registrationManagerState.getRegistrationsList());
for (RegistrationP regOp : registrationManagerState.getPendingOperationsList()) {
pendingOperations.put(ProtoWrapper.of(regOp.getObjectId()), regOp.getOpType());
}
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:21,代码来源:RegistrationManager.java
示例5: getRegistrationManagerStateCopyForTest
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
/**
* Returns a copy of the registration manager's state
* <p>
* Direct test code MUST not call this method on a random thread. It must be called on the
* InvalidationClientImpl's internal thread.
*/
RegistrationManagerState getRegistrationManagerStateCopyForTest(DigestFunction digestFunction) {
List<ObjectIdP> registeredObjects = new ArrayList<ObjectIdP>();
for (ObjectIdP oid : desiredRegistrations.getElements(EMPTY_PREFIX, 0)) {
registeredObjects.add(oid);
}
return new RegistrationManagerState(
RegistrationSummary.newBuilder(getRegistrationSummary()).build(),
RegistrationSummary.newBuilder(lastKnownServerSummary.getProto()).build(),
registeredObjects);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:RegistrationManager.java
示例6: serializeState
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
/** Serializes a Ticl state blob. */
public static byte[] serializeState(
PersistentTiclState state, DigestFunction digestFn) {
Bytes mac = generateMac(state, digestFn);
return PersistentStateBlob.create(state, mac).toByteArray();
}
开发者ID:mogoweb,项目名称:365browser,代码行数:7,代码来源:PersistenceUtils.java
示例7: generateMac
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
/** Returns a message authentication code over {@code state}. */
private static Bytes generateMac(PersistentTiclState state, DigestFunction digestFn) {
digestFn.reset();
digestFn.update(state.toByteArray());
return new Bytes(digestFn.getDigest());
}
开发者ID:mogoweb,项目名称:365browser,代码行数:7,代码来源:PersistenceUtils.java
示例8: getDigestFunctionForTest
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
@Override
public DigestFunction getDigestFunctionForTest() {
return this.digestFn;
}
开发者ID:mogoweb,项目名称:365browser,代码行数:6,代码来源:InvalidationClientCore.java
示例9: SimpleRegistrationStore
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
SimpleRegistrationStore(DigestFunction digestFunction) {
this.digestFunction = digestFunction;
recomputeDigest();
}
开发者ID:mogoweb,项目名称:365browser,代码行数:5,代码来源:SimpleRegistrationStore.java
示例10: getDigestFunctionForTest
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
/** Returns the digest function used for computing digests for object registrations. */
DigestFunction getDigestFunctionForTest();
开发者ID:mogoweb,项目名称:365browser,代码行数:3,代码来源:TestableInvalidationClient.java
示例11: serializeState
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
/** Serializes a Ticl state blob. */
public static byte[] serializeState(PersistentTiclState state, DigestFunction digestFn) {
ByteString mac = generateMac(state, digestFn);
return CommonProtos2.newPersistentStateBlob(state, mac).toByteArray();
}
开发者ID:morristech,项目名称:android-chromium,代码行数:7,代码来源:PersistenceUtils.java
示例12: generateMac
import com.google.ipc.invalidation.common.DigestFunction; //导入依赖的package包/类
/** Returns a message authentication code over {@code state}. */
private static ByteString generateMac(PersistentTiclState state, DigestFunction digestFn) {
digestFn.reset();
digestFn.update(state.toByteArray());
return ByteString.copyFrom(digestFn.getDigest());
}
开发者ID:morristech,项目名称:android-chromium,代码行数:7,代码来源:PersistenceUtils.java
注:本文中的com.google.ipc.invalidation.common.DigestFunction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论