package 㿎;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import okio.ByteString;
import ᨨ.AbstractC1483;
import ᨨ.AbstractC1494;
import ᨨ.C1486;
import 㿎.ሽ.C2540;

/* renamed from: 㿎.㮔  reason: contains not printable characters */
/* compiled from: RequestBody */
public abstract class AbstractC2651 {

    /* renamed from: 㿎.㮔$ʬ  reason: contains not printable characters */
    /* compiled from: RequestBody */
    public class C2652 extends AbstractC2651 {

        /* renamed from: ῲ  reason: contains not printable characters */
        public final /* synthetic */ File f9013;

        /* renamed from: K  reason: contains not printable characters */
        public final /* synthetic */ C2628 f9014;

        public C2652(C2628 r1, File file) {
            this.f9014 = r1;
            this.f9013 = file;
        }

        @Override // 㿎.AbstractC2651
        public long contentLength() {
            return this.f9013.length();
        }

        @Override // 㿎.AbstractC2651
        public C2628 contentType() {
            return this.f9014;
        }

        @Override // 㿎.AbstractC2651
        public void writeTo(AbstractC1483 r3) throws IOException {
            AbstractC1494 r0 = null;
            try {
                r0 = C1486.m3738(this.f9013);
                r3.m3727(r0);
            } finally {
                C2540.m6651(r0);
            }
        }
    }

    /* renamed from: 㿎.㮔$ῲ  reason: contains not printable characters */
    /* compiled from: RequestBody */
    public class C2653 extends AbstractC2651 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final /* synthetic */ byte[] f9015;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final /* synthetic */ int f9016;

        /* renamed from: K  reason: contains not printable characters */
        public final /* synthetic */ C2628 f9017;

        /* renamed from: 㸾  reason: contains not printable characters */
        public final /* synthetic */ int f9018;

        public C2653(C2628 r1, int i, byte[] bArr, int i2) {
            this.f9017 = r1;
            this.f9016 = i;
            this.f9015 = bArr;
            this.f9018 = i2;
        }

        @Override // 㿎.AbstractC2651
        public long contentLength() {
            return (long) this.f9016;
        }

        @Override // 㿎.AbstractC2651
        public C2628 contentType() {
            return this.f9017;
        }

        @Override // 㿎.AbstractC2651
        public void writeTo(AbstractC1483 r4) throws IOException {
            r4.write(this.f9015, this.f9018, this.f9016);
        }
    }

    /* renamed from: 㿎.㮔$K  reason: contains not printable characters */
    /* compiled from: RequestBody */
    public class C2654 extends AbstractC2651 {

        /* renamed from: ῲ  reason: contains not printable characters */
        public final /* synthetic */ ByteString f9019;

        /* renamed from: K  reason: contains not printable characters */
        public final /* synthetic */ C2628 f9020;

        public C2654(C2628 r1, ByteString byteString) {
            this.f9020 = r1;
            this.f9019 = byteString;
        }

        @Override // 㿎.AbstractC2651
        public long contentLength() throws IOException {
            return (long) this.f9019.size();
        }

        @Override // 㿎.AbstractC2651
        public C2628 contentType() {
            return this.f9020;
        }

        @Override // 㿎.AbstractC2651
        public void writeTo(AbstractC1483 r2) throws IOException {
            r2.m3730(this.f9019);
        }
    }

    public static AbstractC2651 create(C2628 r2, String str) {
        Charset charset = C2540.f8566;
        if (r2 != null && (charset = r2.m6938()) == null) {
            charset = C2540.f8566;
            r2 = C2628.m6936(r2 + "; charset=utf-8");
        }
        return create(r2, str.getBytes(charset));
    }

    public long contentLength() throws IOException {
        return -1;
    }

    public abstract C2628 contentType();

    public abstract void writeTo(AbstractC1483 v) throws IOException;

    public static AbstractC2651 create(C2628 r1, ByteString byteString) {
        return new C2654(r1, byteString);
    }

    public static AbstractC2651 create(C2628 r2, byte[] bArr) {
        return create(r2, bArr, 0, bArr.length);
    }

    public static AbstractC2651 create(C2628 r7, byte[] bArr, int i, int i2) {
        if (bArr != null) {
            C2540.m6650((long) bArr.length, (long) i, (long) i2);
            return new C2653(r7, i2, bArr, i);
        }
        throw new NullPointerException("content == null");
    }

    public static AbstractC2651 create(C2628 r1, File file) {
        if (file != null) {
            return new C2652(r1, file);
        }
        throw new NullPointerException("content == null");
    }
}
