discord-jadx/app/src/main/java/c/i/a/c/h2/k.java

57 lines
1.4 KiB
Java

package c.i.a.c.h2;
import com.airbnb.lottie.parser.AnimatableValueParser;
import java.io.IOException;
import java.io.InputStream;
/* compiled from: DataSourceInputStream */
public final class k extends InputStream {
public final j i;
public final l j;
public final byte[] k;
public boolean l = false;
public boolean m = false;
public long n;
public k(j jVar, l lVar) {
this.i = jVar;
this.j = lVar;
this.k = new byte[1];
}
@Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
if (!this.m) {
this.i.close();
this.m = true;
}
}
@Override // java.io.InputStream
public int read() throws IOException {
if (read(this.k) == -1) {
return -1;
}
return this.k[0] & 255;
}
@Override // java.io.InputStream
public int read(byte[] bArr) throws IOException {
return read(bArr, 0, bArr.length);
}
@Override // java.io.InputStream
public int read(byte[] bArr, int i, int i2) throws IOException {
AnimatableValueParser.D(!this.m);
if (!this.l) {
this.i.a(this.j);
this.l = true;
}
int read = this.i.read(bArr, i, i2);
if (read == -1) {
return -1;
}
this.n += (long) read;
return read;
}
}