mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-03 19:18:54 +01:00
40 lines
1.4 KiB
Java
40 lines
1.4 KiB
Java
package com.google.common.hash;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.base.Preconditions;
|
|
import java.io.FilterOutputStream;
|
|
import java.io.IOException;
|
|
import java.io.OutputStream;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Beta
|
|
/* loaded from: classes8.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, java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() throws IOException {
|
|
((FilterOutputStream) this).out.close();
|
|
}
|
|
|
|
public HashCode hash() {
|
|
return this.hasher.hash();
|
|
}
|
|
|
|
@Override // java.io.FilterOutputStream, java.io.OutputStream
|
|
public void write(int i) throws IOException {
|
|
this.hasher.putByte((byte) i);
|
|
((FilterOutputStream) 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);
|
|
((FilterOutputStream) this).out.write(bArr, i, i2);
|
|
}
|
|
}
|