List of usage examples for com.google.common.hash HashCode fromLong
@CheckReturnValue public static HashCode fromLong(long hash)
From source file:ome.util.checksum.FileSizeChecksumProviderImpl.java
@Override public byte[] checksumAsBytes() { isChecksumCalculated = true;// w w w . j av a 2 s .c o m /* use Guava hash code to match the other algorithms */ return HashCode.fromLong(size).asBytes(); }
From source file:com.facebook.buck.rules.keys.ContentAgnosticRuleKeyBuilderFactory.java
public ContentAgnosticRuleKeyBuilderFactory(int seed, SourcePathResolver pathResolver) { super(seed);/*from www . j a va 2 s . c om*/ // Build the cache around the sub-rule-keys and their dep lists. ruleKeyCache = CacheBuilder.newBuilder().weakKeys().build(new CacheLoader<RuleKeyAppendable, RuleKey>() { @Override public RuleKey load(@Nonnull RuleKeyAppendable appendable) throws Exception { RuleKeyBuilder<RuleKey> subKeyBuilder = newBuilder(); appendable.appendToRuleKey(subKeyBuilder); return subKeyBuilder.build(); } }); this.pathResolver = pathResolver; this.fileHashLoader = new FileHashLoader() { @Override public HashCode get(Path path) throws IOException { return HashCode.fromLong(0); } @Override public long getSize(Path path) throws IOException { return 0; } @Override public HashCode get(ArchiveMemberPath archiveMemberPath) throws IOException { throw new AssertionError(); } }; }
From source file:ome.util.checksum.FileSizeChecksumProviderImpl.java
@Override public String checksumAsString() { isChecksumCalculated = true; return HashCode.fromLong(size).toString(); }
From source file:com.facebook.buck.rules.keys.ContentAgnosticRuleKeyFactory.java
public ContentAgnosticRuleKeyFactory(int seed, SourcePathResolver pathResolver, SourcePathRuleFinder ruleFinder) { super(seed);/*from ww w . j a v a 2s .co m*/ this.ruleKeyCache = CacheBuilder.newBuilder().weakKeys() .build(new CacheLoader<RuleKeyAppendable, RuleKey>() { @Override public RuleKey load(@Nonnull RuleKeyAppendable appendable) throws Exception { RuleKeyBuilder<RuleKey> subKeyBuilder = newBuilder(); appendable.appendToRuleKey(subKeyBuilder); return subKeyBuilder.build(); } }); this.pathResolver = pathResolver; this.ruleFinder = ruleFinder; this.fileHashLoader = new FileHashLoader() { @Override public HashCode get(Path path) throws IOException { return HashCode.fromLong(0); } @Override public long getSize(Path path) throws IOException { return 0; } @Override public HashCode get(ArchiveMemberPath archiveMemberPath) throws IOException { throw new AssertionError(); } }; }