本文整理汇总了Java中com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction.update方法的典型用法代码示例。如果您正苦于以下问题:Java Sha1DigestFunction.update方法的具体用法?Java Sha1DigestFunction.update怎么用?Java Sha1DigestFunction.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction
的用法示例。
在下文中一共展示了Sha1DigestFunction.update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDigestedState
import com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction; //导入方法依赖的package包/类
/**
* Returns a {@link AndroidTiclStateWithDigest} containing {@code ticlState} and its computed
* digest.
*/
private static AndroidTiclStateWithDigest createDigestedState(
AndroidInvalidationClientImpl ticl) {
Sha1DigestFunction digester = new Sha1DigestFunction();
ApplicationClientIdP ticlAppId = ticl.getApplicationClientIdP();
Metadata metaData = Metadata.newBuilder()
.setClientConfig(ticl.getConfig())
.setClientName(ticlAppId.getClientName())
.setClientType(ticlAppId.getClientType())
.setTiclId(ticl.getSchedulingId())
.build();
AndroidTiclState state = AndroidTiclState.newBuilder()
.setMetadata(metaData)
.setTiclState(ticl.marshal())
.setVersion(ProtocolIntents.ANDROID_PROTOCOL_VERSION_VALUE).build();
digester.update(state.toByteArray());
AndroidTiclStateWithDigest verifiedState = AndroidTiclStateWithDigest.newBuilder()
.setState(state)
.setDigest(ByteString.copyFrom(digester.getDigest()))
.build();
return verifiedState;
}
示例2: createDigestedState
import com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction; //导入方法依赖的package包/类
/**
* Returns a {@link AndroidTiclStateWithDigest} containing {@code ticlState} and its computed
* digest.
*/
private static AndroidTiclStateWithDigest createDigestedState(
AndroidInvalidationClientImpl ticl) {
Sha1DigestFunction digester = new Sha1DigestFunction();
ApplicationClientIdP ticlAppId = ticl.getApplicationClientIdP();
Metadata metadata = Metadata.create(ticlAppId.getClientType(), ticlAppId.getClientName(),
ticl.getSchedulingId(), ticl.getConfig());
AndroidTiclState state = AndroidTiclState.create(ProtocolIntents.ANDROID_PROTOCOL_VERSION_VALUE,
ticl.marshal(), metadata,
((AndroidInternalScheduler) ticl.getResources().getInternalScheduler()).marshal());
digester.update(state.toByteArray());
AndroidTiclStateWithDigest verifiedState =
AndroidTiclStateWithDigest.create(state, new Bytes(digester.getDigest()));
return verifiedState;
}
示例3: isDigestValid
import com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction; //导入方法依赖的package包/类
/** Returns whether the digest in {@code state} is correct. */
private static boolean isDigestValid(AndroidTiclStateWithDigest state, Logger logger) {
Sha1DigestFunction digester = new Sha1DigestFunction();
digester.update(state.getState().toByteArray());
byte[] computedDigest = digester.getDigest();
if (!TypedUtil.<Bytes>equals(new Bytes(computedDigest), state.getDigest())) {
logger.warning("Android TICL state digest mismatch; computed %s for %s",
computedDigest, state);
return false;
}
return true;
}
示例4: isDigestValid
import com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction; //导入方法依赖的package包/类
/** Returns whether the digest in {@code state} is correct. */
private static boolean isDigestValid(AndroidTiclStateWithDigest state, Logger logger) {
Sha1DigestFunction digester = new Sha1DigestFunction();
digester.update(state.getState().toByteArray());
ByteString computedDigest = ByteString.copyFrom(digester.getDigest());
if (!computedDigest.equals(state.getDigest())) {
logger.warning("Android Ticl state digest mismatch; computed %s for %s",
computedDigest, state);
return false;
}
return true;
}