what-the-bank/sources/com/google/android/gms/internal/firebase_ml/zzfz.java

65 lines
1.8 KiB
Java

package com.google.android.gms.internal.firebase_ml;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
/* loaded from: classes2.dex */
final class zzfz extends FilterInputStream {
private long zzwb;
private final zzfy zzwc;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public zzfz(zzfy zzfyVar, InputStream inputStream) {
super(inputStream);
this.zzwc = zzfyVar;
this.zzwb = 0L;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final int read(byte[] bArr, int i, int i2) throws IOException {
int read = this.in.read(bArr, i, i2);
if (read == -1) {
zzfw();
} else {
this.zzwb += read;
}
return read;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final int read() throws IOException {
int read = this.in.read();
if (read == -1) {
zzfw();
} else {
this.zzwb++;
}
return read;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final long skip(long j) throws IOException {
long skip = this.in.skip(j);
this.zzwb += skip;
return skip;
}
private final void zzfw() throws IOException {
long contentLength = this.zzwc.getContentLength();
if (contentLength == -1) {
return;
}
long j = this.zzwb;
if (j == 0 || j >= contentLength) {
return;
}
StringBuilder sb = new StringBuilder(102);
sb.append("Connection closed prematurely: bytesRead = ");
sb.append(j);
sb.append(", Content-Length = ");
sb.append(contentLength);
throw new IOException(sb.toString());
}
}