mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-26 17:12:31 -06:00
39 lines
1.2 KiB
Java
39 lines
1.2 KiB
Java
|
package com.google.common.hash;
|
||
|
|
||
|
import com.google.common.base.Preconditions;
|
||
|
import java.io.FilterOutputStream;
|
||
|
import java.io.IOException;
|
||
|
import java.io.OutputStream;
|
||
|
|
||
|
@ElementTypesAreNonnullByDefault
|
||
|
/* loaded from: classes3.dex */
|
||
|
public final class HashingOutputStream extends FilterOutputStream {
|
||
|
private final Hasher hasher;
|
||
|
|
||
|
public HashingOutputStream(HashFunction hashFunction, OutputStream outputStream) {
|
||
|
super((OutputStream) Preconditions.checkNotNull(outputStream));
|
||
|
this.hasher = (Hasher) Preconditions.checkNotNull(hashFunction.newHasher());
|
||
|
}
|
||
|
|
||
|
@Override // java.io.FilterOutputStream, java.io.OutputStream
|
||
|
public void write(int i) throws IOException {
|
||
|
this.hasher.putByte((byte) i);
|
||
|
this.out.write(i);
|
||
|
}
|
||
|
|
||
|
@Override // java.io.FilterOutputStream, java.io.OutputStream
|
||
|
public void write(byte[] bArr, int i, int i2) throws IOException {
|
||
|
this.hasher.putBytes(bArr, i, i2);
|
||
|
this.out.write(bArr, i, i2);
|
||
|
}
|
||
|
|
||
|
public HashCode hash() {
|
||
|
return this.hasher.hash();
|
||
|
}
|
||
|
|
||
|
@Override // java.io.FilterOutputStream, java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
|
||
|
public void close() throws IOException {
|
||
|
this.out.close();
|
||
|
}
|
||
|
}
|