package defpackage;

import androidx.media3.container.NalUnitUtil;
import java.io.IOException;
import kotlin.Metadata;
import okhttp3.MediaType;
import okhttp3.RequestBody;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0000\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lc69;", "Lokhttp3/RequestBody;", "ktor-client-okhttp"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public final class c69 extends RequestBody {
    public final Long a;
    public final qq3 b;

    public c69(Long l, qq3 qq3Var) {
        this.a = l;
        this.b = qq3Var;
    }

    @Override // okhttp3.RequestBody
    public final long contentLength() {
        Long l = this.a;
        if (l != null) {
            return l.longValue();
        }
        return -1L;
    }

    @Override // okhttp3.RequestBody
    /* JADX INFO: renamed from: contentType */
    public final MediaType getContentType() {
        return null;
    }

    @Override // okhttp3.RequestBody
    public final boolean isOneShot() {
        return true;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r6v4, types: [java.lang.Throwable] */
    /* JADX WARN: Type inference failed for: r6v6 */
    /* JADX WARN: Type inference failed for: r6v7 */
    /* JADX WARN: Type inference failed for: r6v8 */
    @Override // okhttp3.RequestBody
    public final void writeTo(rh0 rh0Var) throws IOException {
        ?? r6;
        cr4.g(rh0Var, "sink");
        try {
            bn0 bn0Var = (bn0) this.b.invoke();
            cr4.g(bn0Var, "<this>");
            px8 px8VarI = eu6.i(new cc0(bn0Var));
            Long th = null;
            try {
                Long lValueOf = Long.valueOf(rh0Var.r(px8VarI));
                try {
                    px8VarI.close();
                } catch (Throwable th2) {
                    th = th2;
                }
                Long l = th;
                th = lValueOf;
                r6 = l;
            } catch (Throwable th3) {
                try {
                    px8VarI.close();
                    r6 = th3;
                } catch (Throwable th4) {
                    cr2.a(th3, th4);
                    r6 = th3;
                }
            }
            if (r6 != 0) {
                throw r6;
            }
            th.getClass();
        } catch (IOException e) {
            throw e;
        } catch (Throwable th5) {
            throw new p59(th5);
        }
    }
}
