.class public final Lokhttp3/MultipartBody;
.super Lokhttp3/RequestBody;
.source "MultipartBody.kt"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lokhttp3/MultipartBody$Part;,
        Lokhttp3/MultipartBody$a;,
        Lokhttp3/MultipartBody$b;
    }
.end annotation


# static fields
.field public static final f:Lokhttp3/MediaType;

.field public static final g:Lokhttp3/MediaType;

.field public static final h:[B

.field public static final i:[B

.field public static final j:[B

.field public static final k:Lokhttp3/MultipartBody$b;


# instance fields
.field public final a:Lokhttp3/MediaType;

.field public b:J

.field public final c:Lokio/ByteString;

.field public final d:Lokhttp3/MediaType;

.field public final e:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Lokhttp3/MultipartBody$Part;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public static constructor <clinit>()V
    .locals 5

    new-instance v0, Lokhttp3/MultipartBody$b;

    const/4 v1, 0x0

    invoke-direct {v0, v1}, Lokhttp3/MultipartBody$b;-><init>(Lkotlin/jvm/internal/DefaultConstructorMarker;)V

    sput-object v0, Lokhttp3/MultipartBody;->k:Lokhttp3/MultipartBody$b;

    sget-object v0, Lokhttp3/MediaType;->g:Lokhttp3/MediaType$a;

    const-string v0, "multipart/mixed"

    invoke-static {v0}, Lokhttp3/MediaType$a;->a(Ljava/lang/String;)Lokhttp3/MediaType;

    move-result-object v0

    sput-object v0, Lokhttp3/MultipartBody;->f:Lokhttp3/MediaType;

    sget-object v0, Lokhttp3/MediaType;->g:Lokhttp3/MediaType$a;

    const-string v0, "multipart/alternative"

    invoke-static {v0}, Lokhttp3/MediaType$a;->a(Ljava/lang/String;)Lokhttp3/MediaType;

    sget-object v0, Lokhttp3/MediaType;->g:Lokhttp3/MediaType$a;

    const-string v0, "multipart/digest"

    invoke-static {v0}, Lokhttp3/MediaType$a;->a(Ljava/lang/String;)Lokhttp3/MediaType;

    sget-object v0, Lokhttp3/MediaType;->g:Lokhttp3/MediaType$a;

    const-string v0, "multipart/parallel"

    invoke-static {v0}, Lokhttp3/MediaType$a;->a(Ljava/lang/String;)Lokhttp3/MediaType;

    sget-object v0, Lokhttp3/MediaType;->g:Lokhttp3/MediaType$a;

    const-string v0, "multipart/form-data"

    invoke-static {v0}, Lokhttp3/MediaType$a;->a(Ljava/lang/String;)Lokhttp3/MediaType;

    move-result-object v0

    sput-object v0, Lokhttp3/MultipartBody;->g:Lokhttp3/MediaType;

    const/4 v0, 0x2

    new-array v1, v0, [B

    const/16 v2, 0x3a

    int-to-byte v2, v2

    const/4 v3, 0x0

    aput-byte v2, v1, v3

    const/16 v2, 0x20

    int-to-byte v2, v2

    const/4 v4, 0x1

    aput-byte v2, v1, v4

    sput-object v1, Lokhttp3/MultipartBody;->h:[B

    new-array v1, v0, [B

    const/16 v2, 0xd

    int-to-byte v2, v2

    aput-byte v2, v1, v3

    const/16 v2, 0xa

    int-to-byte v2, v2

    aput-byte v2, v1, v4

    sput-object v1, Lokhttp3/MultipartBody;->i:[B

    new-array v0, v0, [B

    const/16 v1, 0x2d

    int-to-byte v1, v1

    aput-byte v1, v0, v3

    aput-byte v1, v0, v4

    sput-object v0, Lokhttp3/MultipartBody;->j:[B

    return-void
.end method

.method public constructor <init>(Lokio/ByteString;Lokhttp3/MediaType;Ljava/util/List;)V
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lokio/ByteString;",
            "Lokhttp3/MediaType;",
            "Ljava/util/List<",
            "Lokhttp3/MultipartBody$Part;",
            ">;)V"
        }
    .end annotation

    const/4 v0, 0x0

    if-eqz p1, :cond_2

    if-eqz p2, :cond_1

    invoke-direct {p0}, Lokhttp3/RequestBody;-><init>()V

    iput-object p1, p0, Lokhttp3/MultipartBody;->c:Lokio/ByteString;

    iput-object p2, p0, Lokhttp3/MultipartBody;->d:Lokhttp3/MediaType;

    iput-object p3, p0, Lokhttp3/MultipartBody;->e:Ljava/util/List;

    sget-object p1, Lokhttp3/MediaType;->g:Lokhttp3/MediaType$a;

    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    iget-object p2, p0, Lokhttp3/MultipartBody;->d:Lokhttp3/MediaType;

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    const-string p2, "; boundary="

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object p2, p0, Lokhttp3/MultipartBody;->c:Lokio/ByteString;

    if-eqz p2, :cond_0

    invoke-static {p2}, Lo0/y/a;->q(Lokio/ByteString;)Ljava/lang/String;

    move-result-object p2

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Lokhttp3/MediaType$a;->a(Ljava/lang/String;)Lokhttp3/MediaType;

    move-result-object p1

    iput-object p1, p0, Lokhttp3/MultipartBody;->a:Lokhttp3/MediaType;

    const-wide/16 p1, -0x1

    iput-wide p1, p0, Lokhttp3/MultipartBody;->b:J

    return-void

    :cond_0
    throw v0

    :cond_1
    const-string p1, "type"

    invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V

    throw v0

    :cond_2
    const-string p1, "boundaryByteString"

    invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V

    throw v0
.end method


# virtual methods
.method public final a(Lokio/BufferedSink;Z)J
    .locals 13
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    const/4 v0, 0x0

    if-eqz p2, :cond_0

    new-instance p1, Lo0/e;

    invoke-direct {p1}, Lo0/e;-><init>()V

    move-object v1, p1

    goto :goto_0

    :cond_0
    move-object v1, v0

    :goto_0
    iget-object v2, p0, Lokhttp3/MultipartBody;->e:Ljava/util/List;

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v2

    const/4 v3, 0x0

    const-wide/16 v4, 0x0

    const/4 v6, 0x0

    :goto_1
    if-ge v6, v2, :cond_8

    iget-object v7, p0, Lokhttp3/MultipartBody;->e:Ljava/util/List;

    invoke-interface {v7, v6}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Lokhttp3/MultipartBody$Part;

    iget-object v8, v7, Lokhttp3/MultipartBody$Part;->a:Lokhttp3/Headers;

    iget-object v7, v7, Lokhttp3/MultipartBody$Part;->b:Lokhttp3/RequestBody;

    if-eqz p1, :cond_7

    sget-object v9, Lokhttp3/MultipartBody;->j:[B

    invoke-interface {p1, v9}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;

    iget-object v9, p0, Lokhttp3/MultipartBody;->c:Lokio/ByteString;

    invoke-interface {p1, v9}, Lokio/BufferedSink;->y0(Lokio/ByteString;)Lokio/BufferedSink;

    sget-object v9, Lokhttp3/MultipartBody;->i:[B

    invoke-interface {p1, v9}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;

    if-eqz v8, :cond_1

    invoke-virtual {v8}, Lokhttp3/Headers;->size()I

    move-result v9

    const/4 v10, 0x0

    :goto_2
    if-ge v10, v9, :cond_1

    invoke-virtual {v8, v10}, Lokhttp3/Headers;->h(I)Ljava/lang/String;

    move-result-object v11

    invoke-interface {p1, v11}, Lokio/BufferedSink;->a0(Ljava/lang/String;)Lokio/BufferedSink;

    move-result-object v11

    sget-object v12, Lokhttp3/MultipartBody;->h:[B

    invoke-interface {v11, v12}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;

    move-result-object v11

    invoke-virtual {v8, v10}, Lokhttp3/Headers;->k(I)Ljava/lang/String;

    move-result-object v12

    invoke-interface {v11, v12}, Lokio/BufferedSink;->a0(Ljava/lang/String;)Lokio/BufferedSink;

    move-result-object v11

    sget-object v12, Lokhttp3/MultipartBody;->i:[B

    invoke-interface {v11, v12}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;

    add-int/lit8 v10, v10, 0x1

    goto :goto_2

    :cond_1
    invoke-virtual {v7}, Lokhttp3/RequestBody;->contentType()Lokhttp3/MediaType;

    move-result-object v8

    if-eqz v8, :cond_2

    const-string v9, "Content-Type: "

    invoke-interface {p1, v9}, Lokio/BufferedSink;->a0(Ljava/lang/String;)Lokio/BufferedSink;

    move-result-object v9

    iget-object v8, v8, Lokhttp3/MediaType;->a:Ljava/lang/String;

    invoke-interface {v9, v8}, Lokio/BufferedSink;->a0(Ljava/lang/String;)Lokio/BufferedSink;

    move-result-object v8

    sget-object v9, Lokhttp3/MultipartBody;->i:[B

    invoke-interface {v8, v9}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;

    :cond_2
    invoke-virtual {v7}, Lokhttp3/RequestBody;->contentLength()J

    move-result-wide v8

    const-wide/16 v10, -0x1

    cmp-long v12, v8, v10

    if-eqz v12, :cond_3

    const-string v10, "Content-Length: "

    invoke-interface {p1, v10}, Lokio/BufferedSink;->a0(Ljava/lang/String;)Lokio/BufferedSink;

    move-result-object v10

    invoke-interface {v10, v8, v9}, Lokio/BufferedSink;->Q0(J)Lokio/BufferedSink;

    move-result-object v10

    sget-object v11, Lokhttp3/MultipartBody;->i:[B

    invoke-interface {v10, v11}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;

    goto :goto_3

    :cond_3
    if-eqz p2, :cond_5

    if-eqz v1, :cond_4

    iget-wide p1, v1, Lo0/e;->e:J

    invoke-virtual {v1, p1, p2}, Lo0/e;->skip(J)V

    return-wide v10

    :cond_4
    invoke-static {}, Lj0/n/c/h;->throwNpe()V

    throw v0

    :cond_5
    :goto_3
    sget-object v10, Lokhttp3/MultipartBody;->i:[B

    invoke-interface {p1, v10}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;

    if-eqz p2, :cond_6

    add-long/2addr v4, v8

    goto :goto_4

    :cond_6
    invoke-virtual {v7, p1}, Lokhttp3/RequestBody;->writeTo(Lokio/BufferedSink;)V

    :goto_4
    sget-object v7, Lokhttp3/MultipartBody;->i:[B

    invoke-interface {p1, v7}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;

    add-int/lit8 v6, v6, 0x1

    goto/16 :goto_1

    :cond_7
    invoke-static {}, Lj0/n/c/h;->throwNpe()V

    throw v0

    :cond_8
    if-eqz p1, :cond_b

    sget-object v2, Lokhttp3/MultipartBody;->j:[B

    invoke-interface {p1, v2}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;

    iget-object v2, p0, Lokhttp3/MultipartBody;->c:Lokio/ByteString;

    invoke-interface {p1, v2}, Lokio/BufferedSink;->y0(Lokio/ByteString;)Lokio/BufferedSink;

    sget-object v2, Lokhttp3/MultipartBody;->j:[B

    invoke-interface {p1, v2}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;

    sget-object v2, Lokhttp3/MultipartBody;->i:[B

    invoke-interface {p1, v2}, Lokio/BufferedSink;->write([B)Lokio/BufferedSink;

    if-eqz p2, :cond_a

    if-eqz v1, :cond_9

    iget-wide p1, v1, Lo0/e;->e:J

    add-long/2addr v4, p1

    invoke-virtual {v1, p1, p2}, Lo0/e;->skip(J)V

    goto :goto_5

    :cond_9
    invoke-static {}, Lj0/n/c/h;->throwNpe()V

    throw v0

    :cond_a
    :goto_5
    return-wide v4

    :cond_b
    invoke-static {}, Lj0/n/c/h;->throwNpe()V

    throw v0
.end method

.method public contentLength()J
    .locals 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    iget-wide v0, p0, Lokhttp3/MultipartBody;->b:J

    const-wide/16 v2, -0x1

    cmp-long v4, v0, v2

    if-nez v4, :cond_0

    const/4 v0, 0x0

    const/4 v1, 0x1

    invoke-virtual {p0, v0, v1}, Lokhttp3/MultipartBody;->a(Lokio/BufferedSink;Z)J

    move-result-wide v0

    iput-wide v0, p0, Lokhttp3/MultipartBody;->b:J

    :cond_0
    return-wide v0
.end method

.method public contentType()Lokhttp3/MediaType;
    .locals 1

    iget-object v0, p0, Lokhttp3/MultipartBody;->a:Lokhttp3/MediaType;

    return-object v0
.end method

.method public writeTo(Lokio/BufferedSink;)V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    if-eqz p1, :cond_0

    const/4 v0, 0x0

    invoke-virtual {p0, p1, v0}, Lokhttp3/MultipartBody;->a(Lokio/BufferedSink;Z)J

    return-void

    :cond_0
    const-string p1, "sink"

    invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V

    const/4 p1, 0x0

    throw p1
.end method