AsyncTimeout$sink$1.smali

.class public final Lokio/AsyncTimeout$sink$1;
.super Ljava/lang/Object;

# interfaces
.implements Lokio/Sink;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lokio/AsyncTimeout;->v(Lokio/Sink;)Lokio/Sink;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x19
    name = null
.end annotation


# instance fields
.field final synthetic f:Lokio/AsyncTimeout;

.field final synthetic g:Lokio/Sink;


# direct methods
.method constructor <init>(Lokio/AsyncTimeout;Lokio/Sink;)V
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lokio/Sink;",
            ")V"
        }
    .end annotation

    iput-object p1, p0, Lokio/AsyncTimeout$sink$1;->f:Lokio/AsyncTimeout;

    iput-object p2, p0, Lokio/AsyncTimeout$sink$1;->g:Lokio/Sink;

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

    return-void
.end method


# virtual methods
.method public D0(Lokio/Buffer;J)V
    .registers 11

    const-string v0, "source"

    invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->c(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {p1}, Lokio/Buffer;->size()J

    move-result-wide v1

    const-wide/16 v3, 0x0

    move-wide v5, p2

    invoke-static/range {v1 .. v6}, Lokio/-Util;->b(JJJ)V

    :goto_f
    const-wide/16 v0, 0x0

    cmp-long v2, p2, v0

    if-lez v2, :cond_68

    iget-object v2, p1, Lokio/Buffer;->f:Lokio/Segment;

    const/4 v3, 0x0

    if-eqz v2, :cond_64

    :goto_1a
    const/high16 v4, 0x10000

    int-to-long v4, v4

    cmp-long v6, v0, v4

    if-gez v6, :cond_37

    iget v4, v2, Lokio/Segment;->c:I

    iget v5, v2, Lokio/Segment;->b:I

    sub-int/2addr v4, v5

    int-to-long v4, v4

    add-long/2addr v0, v4

    cmp-long v4, v0, p2

    if-ltz v4, :cond_2e

    move-wide v0, p2

    goto :goto_37

    :cond_2e
    iget-object v2, v2, Lokio/Segment;->f:Lokio/Segment;

    if-eqz v2, :cond_33

    goto :goto_1a

    :cond_33
    invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->h()V

    throw v3

    :cond_37
    :goto_37
    iget-object v2, p0, Lokio/AsyncTimeout$sink$1;->f:Lokio/AsyncTimeout;

    invoke-virtual {v2}, Lokio/AsyncTimeout;->r()V

    :try_start_3c
    iget-object v4, p0, Lokio/AsyncTimeout$sink$1;->g:Lokio/Sink;

    invoke-interface {v4, p1, v0, v1}, Lokio/Sink;->D0(Lokio/Buffer;J)V

    sget-object v4, Lkotlin/Unit;->a:Lkotlin/Unit;
    :try_end_43
    .catch Ljava/io/IOException; {:try_start_3c .. :try_end_43} :catch_52
    .catchall {:try_start_3c .. :try_end_43} :catchall_50

    invoke-virtual {v2}, Lokio/AsyncTimeout;->s()Z

    move-result v4

    if-nez v4, :cond_4b

    sub-long/2addr p2, v0

    goto :goto_f

    :cond_4b
    invoke-virtual {v2, v3}, Lokio/AsyncTimeout;->m(Ljava/io/IOException;)Ljava/io/IOException;

    move-result-object p1

    throw p1

    :catchall_50
    move-exception p1

    goto :goto_5f

    :catch_52
    move-exception p1

    :try_start_53
    invoke-virtual {v2}, Lokio/AsyncTimeout;->s()Z

    move-result p2

    if-nez p2, :cond_5a

    goto :goto_5e

    :cond_5a
    invoke-virtual {v2, p1}, Lokio/AsyncTimeout;->m(Ljava/io/IOException;)Ljava/io/IOException;

    move-result-object p1

    :goto_5e
    throw p1
    :try_end_5f
    .catchall {:try_start_53 .. :try_end_5f} :catchall_50

    :goto_5f
    invoke-virtual {v2}, Lokio/AsyncTimeout;->s()Z

    move-result p2

    throw p1

    :cond_64
    invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->h()V

    throw v3

    :cond_68
    return-void
.end method

.method public a()Lokio/AsyncTimeout;
    .registers 2

    iget-object v0, p0, Lokio/AsyncTimeout$sink$1;->f:Lokio/AsyncTimeout;

    return-object v0
.end method

.method public close()V
    .registers 4

    iget-object v0, p0, Lokio/AsyncTimeout$sink$1;->f:Lokio/AsyncTimeout;

    invoke-virtual {v0}, Lokio/AsyncTimeout;->r()V

    :try_start_5
    iget-object v1, p0, Lokio/AsyncTimeout$sink$1;->g:Lokio/Sink;

    invoke-interface {v1}, Lokio/Sink;->close()V

    sget-object v1, Lkotlin/Unit;->a:Lkotlin/Unit;
    :try_end_c
    .catch Ljava/io/IOException; {:try_start_5 .. :try_end_c} :catch_1b
    .catchall {:try_start_5 .. :try_end_c} :catchall_19

    invoke-virtual {v0}, Lokio/AsyncTimeout;->s()Z

    move-result v1

    if-nez v1, :cond_13

    return-void

    :cond_13
    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lokio/AsyncTimeout;->m(Ljava/io/IOException;)Ljava/io/IOException;

    move-result-object v0

    throw v0

    :catchall_19
    move-exception v1

    goto :goto_28

    :catch_1b
    move-exception v1

    :try_start_1c
    invoke-virtual {v0}, Lokio/AsyncTimeout;->s()Z

    move-result v2

    if-nez v2, :cond_23

    goto :goto_27

    :cond_23
    invoke-virtual {v0, v1}, Lokio/AsyncTimeout;->m(Ljava/io/IOException;)Ljava/io/IOException;

    move-result-object v1

    :goto_27
    throw v1
    :try_end_28
    .catchall {:try_start_1c .. :try_end_28} :catchall_19

    :goto_28
    invoke-virtual {v0}, Lokio/AsyncTimeout;->s()Z

    move-result v0

    throw v1
.end method

.method public flush()V
    .registers 4

    iget-object v0, p0, Lokio/AsyncTimeout$sink$1;->f:Lokio/AsyncTimeout;

    invoke-virtual {v0}, Lokio/AsyncTimeout;->r()V

    :try_start_5
    iget-object v1, p0, Lokio/AsyncTimeout$sink$1;->g:Lokio/Sink;

    invoke-interface {v1}, Lokio/Sink;->flush()V

    sget-object v1, Lkotlin/Unit;->a:Lkotlin/Unit;
    :try_end_c
    .catch Ljava/io/IOException; {:try_start_5 .. :try_end_c} :catch_1b
    .catchall {:try_start_5 .. :try_end_c} :catchall_19

    invoke-virtual {v0}, Lokio/AsyncTimeout;->s()Z

    move-result v1

    if-nez v1, :cond_13

    return-void

    :cond_13
    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lokio/AsyncTimeout;->m(Ljava/io/IOException;)Ljava/io/IOException;

    move-result-object v0

    throw v0

    :catchall_19
    move-exception v1

    goto :goto_28

    :catch_1b
    move-exception v1

    :try_start_1c
    invoke-virtual {v0}, Lokio/AsyncTimeout;->s()Z

    move-result v2

    if-nez v2, :cond_23

    goto :goto_27

    :cond_23
    invoke-virtual {v0, v1}, Lokio/AsyncTimeout;->m(Ljava/io/IOException;)Ljava/io/IOException;

    move-result-object v1

    :goto_27
    throw v1
    :try_end_28
    .catchall {:try_start_1c .. :try_end_28} :catchall_19

    :goto_28
    invoke-virtual {v0}, Lokio/AsyncTimeout;->s()Z

    move-result v0

    throw v1
.end method

.method public bridge synthetic timeout()Lokio/Timeout;
    .registers 2

    invoke-virtual {p0}, Lokio/AsyncTimeout$sink$1;->a()Lokio/AsyncTimeout;

    move-result-object v0

    return-object v0
.end method

.method public toString()Ljava/lang/String;
    .registers 3

    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v1, "AsyncTimeout.sink("

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

    iget-object v1, p0, Lokio/AsyncTimeout$sink$1;->g:Lokio/Sink;

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

    const/16 v1, 0x29

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

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

    move-result-object v0

    return-object v0
.end method