what-the-bank/sources/o/zBt.java

96 lines
2.4 KiB
Java

package o;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
/* loaded from: classes.dex */
public final class zBt extends FilterInputStream {
private int e;
public zBt(InputStream inputStream) {
super(inputStream);
this.e = PKIFailureInfo.systemUnavail;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final void mark(int i) {
synchronized (this) {
super.mark(i);
this.e = i;
}
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final int read() throws IOException {
if (d(1L) == -1) {
return -1;
}
int read = super.read();
int i = this.e;
if (i != Integer.MIN_VALUE) {
this.e = (int) (i - 1);
}
return read;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final int read(byte[] bArr, int i, int i2) throws IOException {
int d = (int) d(i2);
if (d == -1) {
return -1;
}
int read = super.read(bArr, i, d);
long j = read;
int i3 = this.e;
if (i3 != Integer.MIN_VALUE && j != -1) {
this.e = (int) (i3 - j);
}
return read;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final void reset() throws IOException {
synchronized (this) {
super.reset();
this.e = PKIFailureInfo.systemUnavail;
}
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final long skip(long j) throws IOException {
long d = d(j);
if (d == -1) {
return 0L;
}
long skip = super.skip(d);
int i = this.e;
if (i != Integer.MIN_VALUE && skip != -1) {
this.e = (int) (i - skip);
}
return skip;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final int available() throws IOException {
int i = this.e;
if (i == Integer.MIN_VALUE) {
return super.available();
}
return Math.min(i, super.available());
}
private long d(long j) {
int i = this.e;
if (i == 0) {
return -1L;
}
if (i == Integer.MIN_VALUE) {
return j;
}
long j2 = i;
return j > j2 ? j2 : j;
}
}