94 lines
2.7 KiB
Java
94 lines
2.7 KiB
Java
package okhttp3;
|
|
|
|
import d0.z.d.m;
|
|
import f0.f0.c;
|
|
import g0.g;
|
|
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 */
|
|
public abstract class ResponseBody implements Closeable {
|
|
public static final b i = new b(null);
|
|
public Reader j;
|
|
|
|
/* compiled from: ResponseBody.kt */
|
|
public static final class a extends Reader {
|
|
public boolean i;
|
|
public Reader j;
|
|
public final g k;
|
|
public final Charset l;
|
|
|
|
public a(g gVar, Charset charset) {
|
|
m.checkParameterIsNotNull(gVar, "source");
|
|
m.checkParameterIsNotNull(charset, "charset");
|
|
this.k = gVar;
|
|
this.l = charset;
|
|
}
|
|
|
|
@Override // java.io.Reader, java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() throws IOException {
|
|
this.i = true;
|
|
Reader reader = this.j;
|
|
if (reader != null) {
|
|
reader.close();
|
|
} else {
|
|
this.k.close();
|
|
}
|
|
}
|
|
|
|
@Override // java.io.Reader
|
|
public int read(char[] cArr, int i, int i2) throws IOException {
|
|
m.checkParameterIsNotNull(cArr, "cbuf");
|
|
if (!this.i) {
|
|
Reader reader = this.j;
|
|
if (reader == null) {
|
|
reader = new InputStreamReader(this.k.t0(), c.s(this.k, this.l));
|
|
this.j = reader;
|
|
}
|
|
return reader.read(cArr, i, i2);
|
|
}
|
|
throw new IOException("Stream closed");
|
|
}
|
|
}
|
|
|
|
/* compiled from: ResponseBody.kt */
|
|
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());
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:14:0x0024, code lost:
|
|
r2 = move-exception;
|
|
*/
|
|
/* JADX WARNING: Code restructure failed: missing block: B:15:0x0025, code lost:
|
|
d0.y.b.closeFinally(r0, r1);
|
|
*/
|
|
/* JADX WARNING: Code restructure failed: missing block: B:16:0x0028, code lost:
|
|
throw r2;
|
|
*/
|
|
public final String d() throws IOException {
|
|
Charset charset;
|
|
g c2 = c();
|
|
MediaType b2 = b();
|
|
if (b2 == null || (charset = b2.a(d0.g0.c.a)) == null) {
|
|
charset = d0.g0.c.a;
|
|
}
|
|
String L = c2.L(c.s(c2, charset));
|
|
d0.y.b.closeFinally(c2, null);
|
|
return L;
|
|
}
|
|
}
|