alexandroid/decompiled/jadx/sources/com/google/common/hash/AbstractHashFunction.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

58 lines
2.1 KiB
Java

package com.google.common.hash;
import com.google.common.base.Preconditions;
import com.google.errorprone.annotations.Immutable;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@Immutable
/* loaded from: classes8.dex */
abstract class AbstractHashFunction implements HashFunction {
@Override // com.google.common.hash.HashFunction
public HashCode hashBytes(byte[] bArr, int i, int i2) {
Preconditions.checkPositionIndexes(i, i + i2, bArr.length);
return newHasher(i2).putBytes(bArr, i, i2).hash();
}
@Override // com.google.common.hash.HashFunction
public HashCode hashInt(int i) {
return newHasher(4).putInt(i).hash();
}
@Override // com.google.common.hash.HashFunction
public HashCode hashLong(long j) {
return newHasher(8).putLong(j).hash();
}
@Override // com.google.common.hash.HashFunction
public <T> HashCode hashObject(@ParametricNullness T t, Funnel<? super T> funnel) {
return newHasher().putObject(t, funnel).hash();
}
@Override // com.google.common.hash.HashFunction
public HashCode hashString(CharSequence charSequence, Charset charset) {
return newHasher().putString(charSequence, charset).hash();
}
@Override // com.google.common.hash.HashFunction
public HashCode hashUnencodedChars(CharSequence charSequence) {
return newHasher(charSequence.length() * 2).putUnencodedChars(charSequence).hash();
}
@Override // com.google.common.hash.HashFunction
public Hasher newHasher(int i) {
Preconditions.checkArgument(i >= 0, "expectedInputSize must be >= 0 but was %s", i);
return newHasher();
}
@Override // com.google.common.hash.HashFunction
public HashCode hashBytes(byte[] bArr) {
return hashBytes(bArr, 0, bArr.length);
}
@Override // com.google.common.hash.HashFunction
public HashCode hashBytes(ByteBuffer byteBuffer) {
return newHasher(byteBuffer.remaining()).putBytes(byteBuffer).hash();
}
}