304 lines
11 KiB
Java
304 lines
11 KiB
Java
package okhttp3;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.nio.charset.Charset;
|
|
import o.C14953gcr;
|
|
import o.C14957gcv;
|
|
import o.C15155gij;
|
|
import o.C15160gio;
|
|
import o.InterfaceC15148gic;
|
|
import o.gbF;
|
|
import o.gdP;
|
|
import o.giD;
|
|
import okhttp3.MediaType;
|
|
import okhttp3.internal.Util;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class RequestBody {
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
public long contentLength() throws IOException {
|
|
return -1L;
|
|
}
|
|
|
|
public abstract MediaType contentType();
|
|
|
|
public boolean isDuplex() {
|
|
return false;
|
|
}
|
|
|
|
public boolean isOneShot() {
|
|
return false;
|
|
}
|
|
|
|
public abstract void writeTo(InterfaceC15148gic interfaceC15148gic) throws IOException;
|
|
|
|
/* loaded from: classes.dex */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public static /* synthetic */ RequestBody create$default(Companion companion, String str, MediaType mediaType, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
mediaType = null;
|
|
}
|
|
return companion.create(str, mediaType);
|
|
}
|
|
|
|
public final RequestBody create(String str, MediaType mediaType) {
|
|
C14957gcv.e(str, "");
|
|
Charset charset = gdP.a;
|
|
if (mediaType != null && (charset = MediaType.charset$default(mediaType, null, 1, null)) == null) {
|
|
charset = gdP.a;
|
|
MediaType.Companion companion = MediaType.Companion;
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(mediaType);
|
|
sb.append("; charset=utf-8");
|
|
mediaType = companion.parse(sb.toString());
|
|
}
|
|
byte[] bytes = str.getBytes(charset);
|
|
C14957gcv.c(bytes, "");
|
|
return create(bytes, mediaType, 0, bytes.length);
|
|
}
|
|
|
|
public static /* synthetic */ RequestBody create$default(Companion companion, C15155gij c15155gij, MediaType mediaType, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
mediaType = null;
|
|
}
|
|
return companion.create(c15155gij, mediaType);
|
|
}
|
|
|
|
public final RequestBody create(C15155gij c15155gij, MediaType mediaType) {
|
|
C14957gcv.e(c15155gij, "");
|
|
return new RequestBody(mediaType, c15155gij) { // from class: okhttp3.RequestBody$Companion$toRequestBody$1
|
|
final MediaType $contentType;
|
|
final C15155gij $this_toRequestBody;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
this.$contentType = mediaType;
|
|
this.$this_toRequestBody = c15155gij;
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public final void writeTo(InterfaceC15148gic interfaceC15148gic) {
|
|
C14957gcv.e(interfaceC15148gic, "");
|
|
interfaceC15148gic.b(this.$this_toRequestBody);
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public final long contentLength() {
|
|
return this.$this_toRequestBody.a();
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public final MediaType contentType() {
|
|
return this.$contentType;
|
|
}
|
|
};
|
|
}
|
|
|
|
public static /* synthetic */ RequestBody create$default(Companion companion, byte[] bArr, MediaType mediaType, int i, int i2, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
mediaType = null;
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
i2 = bArr.length;
|
|
}
|
|
return companion.create(bArr, mediaType, i, i2);
|
|
}
|
|
|
|
public final RequestBody create(byte[] bArr, MediaType mediaType, int i, int i2) {
|
|
C14957gcv.e(bArr, "");
|
|
Util.checkOffsetAndCount(bArr.length, i, i2);
|
|
return new RequestBody(mediaType, i2, bArr, i) { // from class: okhttp3.RequestBody$Companion$toRequestBody$2
|
|
final int $byteCount;
|
|
final MediaType $contentType;
|
|
final int $offset;
|
|
final byte[] $this_toRequestBody;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
this.$contentType = mediaType;
|
|
this.$byteCount = i2;
|
|
this.$this_toRequestBody = bArr;
|
|
this.$offset = i;
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public final void writeTo(InterfaceC15148gic interfaceC15148gic) {
|
|
C14957gcv.e(interfaceC15148gic, "");
|
|
interfaceC15148gic.b(this.$this_toRequestBody, this.$offset, this.$byteCount);
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public final MediaType contentType() {
|
|
return this.$contentType;
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public final long contentLength() {
|
|
return this.$byteCount;
|
|
}
|
|
};
|
|
}
|
|
|
|
public static /* synthetic */ RequestBody create$default(Companion companion, File file, MediaType mediaType, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
mediaType = null;
|
|
}
|
|
return companion.create(file, mediaType);
|
|
}
|
|
|
|
public final RequestBody create(File file, MediaType mediaType) {
|
|
C14957gcv.e(file, "");
|
|
return new RequestBody(mediaType, file) { // from class: okhttp3.RequestBody$Companion$asRequestBody$1
|
|
final MediaType $contentType;
|
|
final File $this_asRequestBody;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
this.$contentType = mediaType;
|
|
this.$this_asRequestBody = file;
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public final long contentLength() {
|
|
return this.$this_asRequestBody.length();
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public final void writeTo(InterfaceC15148gic interfaceC15148gic) {
|
|
C14957gcv.e(interfaceC15148gic, "");
|
|
giD a = C15160gio.a(this.$this_asRequestBody);
|
|
try {
|
|
interfaceC15148gic.c(a);
|
|
gbF.d(a, null);
|
|
} finally {
|
|
}
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public final MediaType contentType() {
|
|
return this.$contentType;
|
|
}
|
|
};
|
|
}
|
|
|
|
public final RequestBody create(MediaType mediaType, String str) {
|
|
C14957gcv.e(str, "");
|
|
return create(str, mediaType);
|
|
}
|
|
|
|
public final RequestBody create(MediaType mediaType, C15155gij c15155gij) {
|
|
C14957gcv.e(c15155gij, "");
|
|
return create(c15155gij, mediaType);
|
|
}
|
|
|
|
public static /* synthetic */ RequestBody create$default(Companion companion, MediaType mediaType, byte[] bArr, int i, int i2, int i3, Object obj) {
|
|
if ((i3 & 4) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i3 & 8) != 0) {
|
|
i2 = bArr.length;
|
|
}
|
|
return companion.create(mediaType, bArr, i, i2);
|
|
}
|
|
|
|
public final RequestBody create(MediaType mediaType, byte[] bArr, int i, int i2) {
|
|
C14957gcv.e(bArr, "");
|
|
return create(bArr, mediaType, i, i2);
|
|
}
|
|
|
|
public final RequestBody create(MediaType mediaType, File file) {
|
|
C14957gcv.e(file, "");
|
|
return create(file, mediaType);
|
|
}
|
|
|
|
public final RequestBody create(byte[] bArr, MediaType mediaType, int i) {
|
|
C14957gcv.e(bArr, "");
|
|
return create$default(this, bArr, mediaType, i, 0, 4, (Object) null);
|
|
}
|
|
|
|
public final RequestBody create(byte[] bArr, MediaType mediaType) {
|
|
C14957gcv.e(bArr, "");
|
|
return create$default(this, bArr, mediaType, 0, 0, 6, (Object) null);
|
|
}
|
|
|
|
public final RequestBody create(byte[] bArr) {
|
|
C14957gcv.e(bArr, "");
|
|
return create$default(this, bArr, (MediaType) null, 0, 0, 7, (Object) null);
|
|
}
|
|
|
|
public final RequestBody create(MediaType mediaType, byte[] bArr, int i) {
|
|
C14957gcv.e(bArr, "");
|
|
return create$default(this, mediaType, bArr, i, 0, 8, (Object) null);
|
|
}
|
|
|
|
public final RequestBody create(MediaType mediaType, byte[] bArr) {
|
|
C14957gcv.e(bArr, "");
|
|
return create$default(this, mediaType, bArr, 0, 0, 12, (Object) null);
|
|
}
|
|
|
|
public /* synthetic */ Companion(C14953gcr c14953gcr) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
public static final RequestBody create(byte[] bArr, MediaType mediaType, int i, int i2) {
|
|
return Companion.create(bArr, mediaType, i, i2);
|
|
}
|
|
|
|
public static final RequestBody create(byte[] bArr, MediaType mediaType, int i) {
|
|
return Companion.create(bArr, mediaType, i);
|
|
}
|
|
|
|
public static final RequestBody create(byte[] bArr, MediaType mediaType) {
|
|
return Companion.create(bArr, mediaType);
|
|
}
|
|
|
|
public static final RequestBody create(byte[] bArr) {
|
|
return Companion.create(bArr);
|
|
}
|
|
|
|
public static final RequestBody create(C15155gij c15155gij, MediaType mediaType) {
|
|
return Companion.create(c15155gij, mediaType);
|
|
}
|
|
|
|
public static final RequestBody create(MediaType mediaType, byte[] bArr, int i, int i2) {
|
|
return Companion.create(mediaType, bArr, i, i2);
|
|
}
|
|
|
|
public static final RequestBody create(MediaType mediaType, byte[] bArr, int i) {
|
|
return Companion.create(mediaType, bArr, i);
|
|
}
|
|
|
|
public static final RequestBody create(MediaType mediaType, byte[] bArr) {
|
|
return Companion.create(mediaType, bArr);
|
|
}
|
|
|
|
public static final RequestBody create(MediaType mediaType, C15155gij c15155gij) {
|
|
return Companion.create(mediaType, c15155gij);
|
|
}
|
|
|
|
public static final RequestBody create(MediaType mediaType, String str) {
|
|
return Companion.create(mediaType, str);
|
|
}
|
|
|
|
public static final RequestBody create(MediaType mediaType, File file) {
|
|
return Companion.create(mediaType, file);
|
|
}
|
|
|
|
public static final RequestBody create(String str, MediaType mediaType) {
|
|
return Companion.create(str, mediaType);
|
|
}
|
|
|
|
public static final RequestBody create(File file, MediaType mediaType) {
|
|
return Companion.create(file, mediaType);
|
|
}
|
|
}
|