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

276 lines
6.9 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.io.IOException;
import java.io.OutputStream;
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.gjc, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C15182gjc implements giO {
private boolean b;
public final giM c;
private giX d;
private C15182gjc(giX gix, giM gim) {
if (gix == null) {
throw new IllegalArgumentException("sink == null");
}
this.c = gim;
this.d = gix;
}
public C15182gjc(giX gix) {
this(gix, new giM());
}
@Override // o.giX
public final void write(giM gim, long j) throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
this.c.write(gim, j);
c();
}
@Override // o.giO
public final giO e(giP gip) throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
this.c.e(gip);
return c();
}
@Override // o.giO
public final giO a(byte[] bArr, int i, int i2) throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
this.c.a(bArr, i, i2);
return c();
}
@Override // o.giO
public final long d(giZ giz) throws IOException {
if (giz == null) {
throw new IllegalArgumentException("source == null");
}
long j = 0;
while (true) {
long read = giz.read(this.c, 2048L);
if (read == -1) {
return j;
}
j += read;
c();
}
}
@Override // o.giO
public final giO b(int i) throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
this.c.b(i);
return c();
}
@Override // o.giO
public final giO g(int i) throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
this.c.g(i);
return c();
}
@Override // o.giO
public final giO d(int i) throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
this.c.d(i);
return c();
}
@Override // o.giO
public final giO i(long j) throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
this.c.i(j);
return c();
}
@Override // o.giO
public final giO k(long j) throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
this.c.k(j);
return c();
}
@Override // o.giO
public final giO c() throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
giM gim = this.c;
long j = gim.a;
if (j == 0) {
j = 0;
} else {
C15186gjg c15186gjg = gim.c.e;
if (c15186gjg.c < 2048 && c15186gjg.d) {
j -= c15186gjg.c - c15186gjg.g;
}
}
if (j > 0) {
this.d.write(this.c, j);
}
return this;
}
@Override // o.giO
public final OutputStream h() {
return new OutputStream(this) { // from class: o.gjc.1
private C15182gjc d;
{
this.d = this;
}
@Override // java.io.OutputStream
public final void write(int i) throws IOException {
if (this.d.b) {
throw new IOException("closed");
}
this.d.c.b((int) ((byte) i));
this.d.c();
}
@Override // java.io.OutputStream
public final void write(byte[] bArr, int i, int i2) throws IOException {
if (this.d.b) {
throw new IOException("closed");
}
this.d.c.a(bArr, i, i2);
this.d.c();
}
@Override // java.io.OutputStream, java.io.Flushable
public final void flush() throws IOException {
if (this.d.b) {
return;
}
this.d.flush();
}
@Override // java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
public final void close() throws IOException {
this.d.close();
}
public final String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.d);
sb.append(".outputStream()");
return sb.toString();
}
};
}
@Override // o.giX, java.io.Flushable
public final void flush() throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
if (this.c.a > 0) {
giX gix = this.d;
giM gim = this.c;
gix.write(gim, gim.a);
}
this.d.flush();
}
@Override // o.giX, java.io.Closeable, java.lang.AutoCloseable
public final void close() throws IOException {
if (this.b) {
return;
}
try {
if (this.c.a > 0) {
giX gix = this.d;
giM gim = this.c;
gix.write(gim, gim.a);
}
th = null;
} catch (Throwable th) {
th = th;
}
try {
this.d.close();
} catch (Throwable th2) {
if (th == null) {
th = th2;
}
}
this.b = true;
if (th != null) {
C15183gjd.e(th);
}
}
@Override // o.giX
public final giY timeout() {
return this.d.timeout();
}
public final String toString() {
StringBuilder sb = new StringBuilder("buffer(");
sb.append(this.d);
sb.append(")");
return sb.toString();
}
@Override // o.giO
public final giO e() throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
long j = this.c.a;
if (j > 0) {
this.d.write(this.c, j);
}
return this;
}
@Override // o.giO
public final giO a(byte[] bArr) throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
giM gim = this.c;
if (bArr == null) {
throw new IllegalArgumentException("source == null");
}
gim.a(bArr, 0, bArr.length);
return c();
}
@Override // o.giO
public final giO c(String str) throws IOException {
if (this.b) {
throw new IllegalStateException("closed");
}
this.c.b(str, 0, str.length());
return c();
}
@Override // o.giO, o.InterfaceC15142giR
public final giM b() {
return this.c;
}
}