alexandroid/decompiled/jadx/sources/com/google/common/hash/HashingInputStream.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
1.8 KiB
Java

package com.google.common.hash;
import com.google.common.annotations.Beta;
import com.google.common.base.Preconditions;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@Beta
/* loaded from: classes8.dex */
public final class HashingInputStream extends FilterInputStream {
private final Hasher hasher;
public HashingInputStream(HashFunction hashFunction, InputStream inputStream) {
super((InputStream) Preconditions.checkNotNull(inputStream));
this.hasher = (Hasher) Preconditions.checkNotNull(hashFunction.newHasher());
}
public HashCode hash() {
return this.hasher.hash();
}
@Override // java.io.FilterInputStream, java.io.InputStream
public boolean markSupported() {
return false;
}
@Override // java.io.FilterInputStream, java.io.InputStream
@CanIgnoreReturnValue
public int read() throws IOException {
int read = ((FilterInputStream) this).in.read();
if (read != -1) {
this.hasher.putByte((byte) read);
}
return read;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public void reset() throws IOException {
throw new IOException("reset not supported");
}
@Override // java.io.FilterInputStream, java.io.InputStream
@CanIgnoreReturnValue
public int read(byte[] bArr, int i, int i2) throws IOException {
int read = ((FilterInputStream) this).in.read(bArr, i, i2);
if (read != -1) {
this.hasher.putBytes(bArr, i, read);
}
return read;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public void mark(int i) {
}
}