discord-jadx/app/src/main/java/f0/u.java

84 lines
2.2 KiB
Java

package f0;
import d0.z.d.m;
import f0.f0.c;
import g0.e;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okio.BufferedSink;
/* compiled from: FormBody.kt */
public final class u extends RequestBody {
public static final MediaType a = MediaType.a.a("application/x-www-form-urlencoded");
public final List<String> b;
/* renamed from: c reason: collision with root package name */
public final List<String> f2771c;
/* compiled from: FormBody.kt */
public static final class a {
public final List<String> a = new ArrayList();
public final List<String> b = new ArrayList();
/* renamed from: c reason: collision with root package name */
public final Charset f2772c = null;
}
static {
MediaType.a aVar = MediaType.f2869c;
}
public u(List<String> list, List<String> list2) {
m.checkParameterIsNotNull(list, "encodedNames");
m.checkParameterIsNotNull(list2, "encodedValues");
this.b = c.z(list);
this.f2771c = c.z(list2);
}
public final long a(BufferedSink bufferedSink, boolean z2) {
e eVar;
if (z2) {
eVar = new e();
} else {
if (bufferedSink == null) {
m.throwNpe();
}
eVar = bufferedSink.g();
}
int size = this.b.size();
for (int i = 0; i < size; i++) {
if (i > 0) {
eVar.T(38);
}
eVar.b0(this.b.get(i));
eVar.T(61);
eVar.b0(this.f2771c.get(i));
}
if (!z2) {
return 0;
}
long j = eVar.j;
eVar.skip(j);
return j;
}
@Override // okhttp3.RequestBody
public long contentLength() {
return a(null, true);
}
@Override // okhttp3.RequestBody
public MediaType contentType() {
return a;
}
@Override // okhttp3.RequestBody
public void writeTo(BufferedSink bufferedSink) throws IOException {
m.checkParameterIsNotNull(bufferedSink, "sink");
a(bufferedSink, false);
}
}