discord-jadx/app/src/main/java/okhttp3/ResponseBody.java

95 lines
2.6 KiB
Java
Raw Normal View History

2021-08-03 07:33:18 +00:00
package okhttp3;
2021-11-02 06:38:17 +00:00
import d0.z.d.m;
import f0.e0.c;
import g0.g;
2021-08-03 07:33:18 +00:00
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: ResponseBody.kt */
2022-03-07 09:34:54 +00:00
/* loaded from: classes3.dex */
2021-08-03 07:33:18 +00:00
public abstract class ResponseBody implements Closeable {
2021-12-02 18:53:44 +00:00
public static final b j = new b(null);
public Reader k;
2021-08-03 07:33:18 +00:00
/* compiled from: ResponseBody.kt */
2022-03-07 09:34:54 +00:00
/* loaded from: classes3.dex */
2021-08-03 07:33:18 +00:00
public static final class a extends Reader {
2021-12-02 18:53:44 +00:00
public boolean j;
public Reader k;
public final g l;
public final Charset m;
2021-08-03 07:33:18 +00:00
public a(g gVar, Charset charset) {
m.checkParameterIsNotNull(gVar, "source");
m.checkParameterIsNotNull(charset, "charset");
2021-12-02 18:53:44 +00:00
this.l = gVar;
this.m = charset;
2021-08-03 07:33:18 +00:00
}
@Override // java.io.Reader, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
2021-12-02 18:53:44 +00:00
this.j = true;
Reader reader = this.k;
2021-08-03 07:33:18 +00:00
if (reader != null) {
reader.close();
} else {
2021-12-02 18:53:44 +00:00
this.l.close();
2021-08-03 07:33:18 +00:00
}
}
@Override // java.io.Reader
public int read(char[] cArr, int i, int i2) throws IOException {
m.checkParameterIsNotNull(cArr, "cbuf");
2021-12-02 18:53:44 +00:00
if (!this.j) {
Reader reader = this.k;
2021-08-03 07:33:18 +00:00
if (reader == null) {
2021-12-02 18:53:44 +00:00
reader = new InputStreamReader(this.l.u0(), c.s(this.l, this.m));
this.k = reader;
2021-08-03 07:33:18 +00:00
}
return reader.read(cArr, i, i2);
}
throw new IOException("Stream closed");
}
}
/* compiled from: ResponseBody.kt */
2022-03-07 09:34:54 +00:00
/* loaded from: classes3.dex */
2021-08-03 07:33:18 +00:00
public static final class b {
public b(DefaultConstructorMarker defaultConstructorMarker) {
}
}
public abstract long a();
public abstract MediaType b();
public abstract g c();
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() {
c.d(c());
}
public final String d() throws IOException {
Charset charset;
2021-12-17 21:59:34 +00:00
g c = c();
2022-03-07 09:34:54 +00:00
try {
MediaType b2 = b();
if (b2 == null || (charset = b2.a(d0.g0.c.a)) == null) {
charset = d0.g0.c.a;
}
th = null;
return c.M(c.s(c, charset));
} finally {
try {
throw th;
} finally {
}
2021-08-03 07:33:18 +00:00
}
}
}