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

241 lines
6.4 KiB
Java

package o;
import java.nio.ByteBuffer;
/* renamed from: o.giq, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C15162giq implements InterfaceC15148gic {
private boolean a;
private C15111ghZ c;
private InterfaceC15168giw d;
public C15162giq(InterfaceC15168giw interfaceC15168giw) {
C14957gcv.e(interfaceC15168giw, "");
this.d = interfaceC15168giw;
this.c = new C15111ghZ();
}
@Override // java.nio.channels.WritableByteChannel
public final int write(ByteBuffer byteBuffer) {
C14957gcv.e(byteBuffer, "");
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
int write = this.c.write(byteBuffer);
b();
return write;
}
@Override // o.InterfaceC15168giw
public final void write(C15111ghZ c15111ghZ, long j) {
C14957gcv.e(c15111ghZ, "");
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
this.c.write(c15111ghZ, j);
b();
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic b(C15155gij c15155gij) {
C14957gcv.e(c15155gij, "");
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
C15111ghZ c15111ghZ = this.c;
C14957gcv.e(c15155gij, "");
c15155gij.a(c15111ghZ, c15155gij.a());
return b();
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic d(String str) {
C14957gcv.e(str, "");
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
C15111ghZ c15111ghZ = this.c;
C14957gcv.e(str, "");
c15111ghZ.c(str, 0, str.length());
return b();
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic c(String str, int i, int i2) {
C14957gcv.e(str, "");
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
this.c.c(str, i, i2);
return b();
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic a(byte[] bArr) {
C14957gcv.e(bArr, "");
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
C15111ghZ c15111ghZ = this.c;
C14957gcv.e(bArr, "");
c15111ghZ.b(bArr, 0, bArr.length);
return b();
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic b(byte[] bArr, int i, int i2) {
C14957gcv.e(bArr, "");
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
this.c.b(bArr, i, i2);
return b();
}
@Override // o.InterfaceC15148gic
public final long c(giD gid) {
C14957gcv.e(gid, "");
long j = 0;
while (true) {
long read = gid.read(this.c, 8192L);
if (read == -1) {
return j;
}
j += read;
b();
}
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic b(int i) {
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
this.c.b(i);
return b();
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic g(int i) {
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
this.c.g(i);
return b();
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic j(int i) {
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
this.c.j(i);
return b();
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic h(long j) {
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
this.c.h(j);
return b();
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic l(long j) {
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
this.c.l(j);
return b();
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic b() {
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
long e = this.c.e();
if (e > 0) {
this.d.write(this.c, e);
}
return this;
}
@Override // o.InterfaceC15168giw
public final C15139giB 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.InterfaceC15168giw, java.io.Closeable, java.lang.AutoCloseable
public final void close() {
if (this.a) {
return;
}
try {
if (this.c.c > 0) {
InterfaceC15168giw interfaceC15168giw = this.d;
C15111ghZ c15111ghZ = this.c;
interfaceC15168giw.write(c15111ghZ, c15111ghZ.c);
}
th = null;
} catch (Throwable th) {
th = th;
}
try {
this.d.close();
} catch (Throwable th2) {
if (th == null) {
th = th2;
}
}
this.a = true;
if (th != null) {
throw th;
}
}
@Override // o.InterfaceC15148gic
public final InterfaceC15148gic a() {
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
long j = this.c.c;
if (j > 0) {
this.d.write(this.c, j);
}
return this;
}
@Override // o.InterfaceC15148gic, o.InterfaceC15168giw, java.io.Flushable
public final void flush() {
if (!(!this.a)) {
throw new IllegalStateException("closed".toString());
}
if (this.c.c > 0) {
InterfaceC15168giw interfaceC15168giw = this.d;
C15111ghZ c15111ghZ = this.c;
interfaceC15168giw.write(c15111ghZ, c15111ghZ.c);
}
this.d.flush();
}
@Override // java.nio.channels.Channel
public final boolean isOpen() {
return !this.a;
}
@Override // o.InterfaceC15148gic
public final C15111ghZ i() {
return this.c;
}
}