mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 17:42:33 -06:00
53 lines
1.6 KiB
Java
53 lines
1.6 KiB
Java
package com.google.common.hash;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
import java.io.FilterInputStream;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
|
|
@ElementTypesAreNonnullByDefault
|
|
/* loaded from: classes3.dex */
|
|
public final class HashingInputStream extends FilterInputStream {
|
|
private final Hasher hasher;
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public void mark(int i) {
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public boolean markSupported() {
|
|
return false;
|
|
}
|
|
|
|
public HashingInputStream(HashFunction hashFunction, InputStream inputStream) {
|
|
super((InputStream) Preconditions.checkNotNull(inputStream));
|
|
this.hasher = (Hasher) Preconditions.checkNotNull(hashFunction.newHasher());
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public int read() throws IOException {
|
|
int read = this.in.read();
|
|
if (read != -1) {
|
|
this.hasher.putByte((byte) read);
|
|
}
|
|
return read;
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public int read(byte[] bArr, int i, int i2) throws IOException {
|
|
int read = 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 reset() throws IOException {
|
|
throw new IOException("reset not supported");
|
|
}
|
|
|
|
public HashCode hash() {
|
|
return this.hasher.hash();
|
|
}
|
|
}
|