mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 16:42:30 -06:00
315 lines
17 KiB
Java
315 lines
17 KiB
Java
package okhttp3;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.nio.charset.Charset;
|
|
import kotlin.Deprecated;
|
|
import kotlin.DeprecationLevel;
|
|
import kotlin.Metadata;
|
|
import kotlin.ReplaceWith;
|
|
import kotlin.io.CloseableKt;
|
|
import kotlin.jvm.JvmStatic;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.text.Charsets;
|
|
import okhttp3.internal.Util;
|
|
import okio.BufferedSink;
|
|
import okio.ByteString;
|
|
import okio.Okio;
|
|
import okio.Source;
|
|
|
|
/* compiled from: RequestBody.kt */
|
|
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b&\u0018\u0000 \u000e2\u00020\u0001:\u0001\u000eB\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H\u0016J\n\u0010\u0005\u001a\u0004\u0018\u00010\u0006H&J\b\u0010\u0007\u001a\u00020\bH\u0016J\b\u0010\t\u001a\u00020\bH\u0016J\u0010\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\rH&¨\u0006\u000f"}, d2 = {"Lokhttp3/RequestBody;", "", "()V", "contentLength", "", "contentType", "Lokhttp3/MediaType;", "isDuplex", "", "isOneShot", "writeTo", "", "sink", "Lokio/BufferedSink;", "Companion", "okhttp"}, k = 1, mv = {1, 4, 0})
|
|
/* loaded from: classes3.dex */
|
|
public abstract class RequestBody {
|
|
|
|
/* renamed from: Companion, reason: from kotlin metadata */
|
|
public static final Companion INSTANCE = new Companion(null);
|
|
|
|
@JvmStatic
|
|
public static final RequestBody create(File file, MediaType mediaType) {
|
|
return INSTANCE.create(file, mediaType);
|
|
}
|
|
|
|
@JvmStatic
|
|
public static final RequestBody create(String str, MediaType mediaType) {
|
|
return INSTANCE.create(str, mediaType);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'file' argument first to fix Java", replaceWith = @ReplaceWith(expression = "file.asRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.asRequestBody"}))
|
|
@JvmStatic
|
|
public static final RequestBody create(MediaType mediaType, File file) {
|
|
return INSTANCE.create(mediaType, file);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
|
|
@JvmStatic
|
|
public static final RequestBody create(MediaType mediaType, String str) {
|
|
return INSTANCE.create(mediaType, str);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
|
|
@JvmStatic
|
|
public static final RequestBody create(MediaType mediaType, ByteString byteString) {
|
|
return INSTANCE.create(mediaType, byteString);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
|
|
@JvmStatic
|
|
public static final RequestBody create(MediaType mediaType, byte[] bArr) {
|
|
return Companion.create$default(INSTANCE, mediaType, bArr, 0, 0, 12, (Object) null);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
|
|
@JvmStatic
|
|
public static final RequestBody create(MediaType mediaType, byte[] bArr, int i) {
|
|
return Companion.create$default(INSTANCE, mediaType, bArr, i, 0, 8, (Object) null);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
|
|
@JvmStatic
|
|
public static final RequestBody create(MediaType mediaType, byte[] bArr, int i, int i2) {
|
|
return INSTANCE.create(mediaType, bArr, i, i2);
|
|
}
|
|
|
|
@JvmStatic
|
|
public static final RequestBody create(ByteString byteString, MediaType mediaType) {
|
|
return INSTANCE.create(byteString, mediaType);
|
|
}
|
|
|
|
@JvmStatic
|
|
public static final RequestBody create(byte[] bArr) {
|
|
return Companion.create$default(INSTANCE, bArr, (MediaType) null, 0, 0, 7, (Object) null);
|
|
}
|
|
|
|
@JvmStatic
|
|
public static final RequestBody create(byte[] bArr, MediaType mediaType) {
|
|
return Companion.create$default(INSTANCE, bArr, mediaType, 0, 0, 6, (Object) null);
|
|
}
|
|
|
|
@JvmStatic
|
|
public static final RequestBody create(byte[] bArr, MediaType mediaType, int i) {
|
|
return Companion.create$default(INSTANCE, bArr, mediaType, i, 0, 4, (Object) null);
|
|
}
|
|
|
|
@JvmStatic
|
|
public static final RequestBody create(byte[] bArr, MediaType mediaType, int i, int i2) {
|
|
return INSTANCE.create(bArr, mediaType, i, i2);
|
|
}
|
|
|
|
public long contentLength() throws IOException {
|
|
return -1L;
|
|
}
|
|
|
|
/* renamed from: contentType */
|
|
public abstract MediaType get$contentType();
|
|
|
|
public boolean isDuplex() {
|
|
return false;
|
|
}
|
|
|
|
public boolean isOneShot() {
|
|
return false;
|
|
}
|
|
|
|
public abstract void writeTo(BufferedSink sink) throws IOException;
|
|
|
|
/* compiled from: RequestBody.kt */
|
|
@Metadata(bv = {1, 0, 3}, d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u001a\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0007J.\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\t\u001a\u00020\n2\b\b\u0002\u0010\u000b\u001a\u00020\f2\b\b\u0002\u0010\r\u001a\u00020\fH\u0007J\u001a\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\t\u001a\u00020\u000eH\u0007J\u001a\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\t\u001a\u00020\u000fH\u0007J\u001d\u0010\u0010\u001a\u00020\u0004*\u00020\b2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006H\u0007¢\u0006\u0002\b\u0003J1\u0010\u0011\u001a\u00020\u0004*\u00020\n2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u00062\b\b\u0002\u0010\u000b\u001a\u00020\f2\b\b\u0002\u0010\r\u001a\u00020\fH\u0007¢\u0006\u0002\b\u0003J\u001d\u0010\u0011\u001a\u00020\u0004*\u00020\u000e2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006H\u0007¢\u0006\u0002\b\u0003J\u001d\u0010\u0011\u001a\u00020\u0004*\u00020\u000f2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006H\u0007¢\u0006\u0002\b\u0003¨\u0006\u0012"}, d2 = {"Lokhttp3/RequestBody$Companion;", "", "()V", "create", "Lokhttp3/RequestBody;", "contentType", "Lokhttp3/MediaType;", "file", "Ljava/io/File;", "content", "", "offset", "", "byteCount", "", "Lokio/ByteString;", "asRequestBody", "toRequestBody", "okhttp"}, k = 1, mv = {1, 4, 0})
|
|
/* loaded from: classes3.dex */
|
|
public static final class Companion {
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
|
|
@JvmStatic
|
|
public final RequestBody create(MediaType mediaType, byte[] bArr) {
|
|
return create$default(this, mediaType, bArr, 0, 0, 12, (Object) null);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
|
|
@JvmStatic
|
|
public final RequestBody create(MediaType mediaType, byte[] bArr, int i) {
|
|
return create$default(this, mediaType, bArr, i, 0, 8, (Object) null);
|
|
}
|
|
|
|
@JvmStatic
|
|
public final RequestBody create(byte[] bArr) {
|
|
return create$default(this, bArr, (MediaType) null, 0, 0, 7, (Object) null);
|
|
}
|
|
|
|
@JvmStatic
|
|
public final RequestBody create(byte[] bArr, MediaType mediaType) {
|
|
return create$default(this, bArr, mediaType, 0, 0, 6, (Object) null);
|
|
}
|
|
|
|
@JvmStatic
|
|
public final RequestBody create(byte[] bArr, MediaType mediaType, int i) {
|
|
return create$default(this, bArr, mediaType, i, 0, 4, (Object) null);
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
@JvmStatic
|
|
public final RequestBody create(String toRequestBody, MediaType mediaType) {
|
|
Intrinsics.checkNotNullParameter(toRequestBody, "$this$toRequestBody");
|
|
Charset charset = Charsets.UTF_8;
|
|
if (mediaType != null && (charset = MediaType.charset$default(mediaType, null, 1, null)) == null) {
|
|
charset = Charsets.UTF_8;
|
|
mediaType = MediaType.INSTANCE.parse(mediaType + "; charset=utf-8");
|
|
}
|
|
byte[] bytes = toRequestBody.getBytes(charset);
|
|
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
|
|
return create(bytes, mediaType, 0, bytes.length);
|
|
}
|
|
|
|
public static /* synthetic */ RequestBody create$default(Companion companion, ByteString byteString, MediaType mediaType, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
mediaType = null;
|
|
}
|
|
return companion.create(byteString, mediaType);
|
|
}
|
|
|
|
@JvmStatic
|
|
public final RequestBody create(final ByteString toRequestBody, final MediaType mediaType) {
|
|
Intrinsics.checkNotNullParameter(toRequestBody, "$this$toRequestBody");
|
|
return new RequestBody() { // from class: okhttp3.RequestBody$Companion$toRequestBody$1
|
|
@Override // okhttp3.RequestBody
|
|
/* renamed from: contentType, reason: from getter */
|
|
public MediaType get$contentType() {
|
|
return mediaType;
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public long contentLength() {
|
|
return ByteString.this.size();
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public void writeTo(BufferedSink sink) {
|
|
Intrinsics.checkNotNullParameter(sink, "sink");
|
|
sink.write(ByteString.this);
|
|
}
|
|
};
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
@JvmStatic
|
|
public final RequestBody create(final byte[] toRequestBody, final MediaType mediaType, final int i, final int i2) {
|
|
Intrinsics.checkNotNullParameter(toRequestBody, "$this$toRequestBody");
|
|
Util.checkOffsetAndCount(toRequestBody.length, i, i2);
|
|
return new RequestBody() { // from class: okhttp3.RequestBody$Companion$toRequestBody$2
|
|
@Override // okhttp3.RequestBody
|
|
public long contentLength() {
|
|
return i2;
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
/* renamed from: contentType, reason: from getter */
|
|
public MediaType get$contentType() {
|
|
return mediaType;
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public void writeTo(BufferedSink sink) {
|
|
Intrinsics.checkNotNullParameter(sink, "sink");
|
|
sink.write(toRequestBody, i, i2);
|
|
}
|
|
};
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
@JvmStatic
|
|
public final RequestBody create(final File asRequestBody, final MediaType mediaType) {
|
|
Intrinsics.checkNotNullParameter(asRequestBody, "$this$asRequestBody");
|
|
return new RequestBody() { // from class: okhttp3.RequestBody$Companion$asRequestBody$1
|
|
@Override // okhttp3.RequestBody
|
|
/* renamed from: contentType, reason: from getter */
|
|
public MediaType get$contentType() {
|
|
return mediaType;
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public long contentLength() {
|
|
return asRequestBody.length();
|
|
}
|
|
|
|
@Override // okhttp3.RequestBody
|
|
public void writeTo(BufferedSink sink) {
|
|
Intrinsics.checkNotNullParameter(sink, "sink");
|
|
Source source = Okio.source(asRequestBody);
|
|
try {
|
|
sink.writeAll(source);
|
|
CloseableKt.closeFinally(source, null);
|
|
} finally {
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
|
|
@JvmStatic
|
|
public final RequestBody create(MediaType contentType, String content) {
|
|
Intrinsics.checkNotNullParameter(content, "content");
|
|
return create(content, contentType);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
|
|
@JvmStatic
|
|
public final RequestBody create(MediaType contentType, ByteString content) {
|
|
Intrinsics.checkNotNullParameter(content, "content");
|
|
return create(content, contentType);
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
|
|
@JvmStatic
|
|
public final RequestBody create(MediaType contentType, byte[] content, int offset, int byteCount) {
|
|
Intrinsics.checkNotNullParameter(content, "content");
|
|
return create(content, contentType, offset, byteCount);
|
|
}
|
|
|
|
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'file' argument first to fix Java", replaceWith = @ReplaceWith(expression = "file.asRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.asRequestBody"}))
|
|
@JvmStatic
|
|
public final RequestBody create(MediaType contentType, File file) {
|
|
Intrinsics.checkNotNullParameter(file, "file");
|
|
return create(file, contentType);
|
|
}
|
|
}
|
|
}
|