.class public final Lz9/b$b;
.super Lha/k;
.source ""


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lz9/b;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x11
    name = "b"
.end annotation


# instance fields
.field public s:J

.field public t:Z

.field public u:Z

.field public v:Z

.field public final w:J

.field public final synthetic x:Lz9/b;


# direct methods
.method public constructor <init>(Lz9/b;Lha/z;J)V
    .registers 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lha/z;",
            "J)V"
        }
    .end annotation

    const-string v0, "delegate"

    invoke-static {p2, v0}, Lx/e;->f(Ljava/lang/Object;Ljava/lang/String;)V

    iput-object p1, p0, Lz9/b$b;->x:Lz9/b;

    invoke-direct {p0, p2}, Lha/k;-><init>(Lha/z;)V

    iput-wide p3, p0, Lz9/b$b;->w:J

    const/4 p1, 0x1

    iput-boolean p1, p0, Lz9/b$b;->t:Z

    const-wide/16 p1, 0x0

    cmp-long p1, p3, p1

    if-nez p1, :cond_19

    const/4 p1, 0x0

    invoke-virtual {p0, p1}, Lz9/b$b;->b(Ljava/io/IOException;)Ljava/io/IOException;

    :cond_19
    return-void
.end method


# virtual methods
.method public final b(Ljava/io/IOException;)Ljava/io/IOException;
    .registers 10
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<E:",
            "Ljava/io/IOException;",
            ">(TE;)TE;"
        }
    .end annotation

    iget-boolean v0, p0, Lz9/b$b;->u:Z

    if-eqz v0, :cond_5

    return-object p1

    :cond_5
    const/4 v0, 0x1

    iput-boolean v0, p0, Lz9/b$b;->u:Z

    if-nez p1, :cond_1f

    iget-boolean v0, p0, Lz9/b$b;->t:Z

    if-eqz v0, :cond_1f

    const/4 v0, 0x0

    iput-boolean v0, p0, Lz9/b$b;->t:Z

    iget-object v0, p0, Lz9/b$b;->x:Lz9/b;

    .line 1
    iget-object v1, v0, Lz9/b;->d:Lv9/r;

    .line 2
    iget-object v0, v0, Lz9/b;->c:Lz9/d;

    .line 3
    invoke-static {v1}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    const-string v1, "call"

    .line 4
    invoke-static {v0, v1}, Lx/e;->f(Ljava/lang/Object;Ljava/lang/String;)V

    .line 5
    :cond_1f
    iget-object v2, p0, Lz9/b$b;->x:Lz9/b;

    iget-wide v3, p0, Lz9/b$b;->s:J

    const/4 v5, 0x1

    const/4 v6, 0x0

    move-object v7, p1

    invoke-virtual/range {v2 .. v7}, Lz9/b;->a(JZZLjava/io/IOException;)Ljava/io/IOException;

    move-result-object p1

    return-object p1
.end method

.method public close()V
    .registers 2

    iget-boolean v0, p0, Lz9/b$b;->v:Z

    if-eqz v0, :cond_5

    return-void

    :cond_5
    const/4 v0, 0x1

    iput-boolean v0, p0, Lz9/b$b;->v:Z

    .line 1
    :try_start_8
    iget-object v0, p0, Lha/k;->r:Lha/z;

    invoke-interface {v0}, Lha/z;->close()V

    const/4 v0, 0x0

    .line 2
    invoke-virtual {p0, v0}, Lz9/b$b;->b(Ljava/io/IOException;)Ljava/io/IOException;
    :try_end_11
    .catch Ljava/io/IOException; {:try_start_8 .. :try_end_11} :catch_12

    return-void

    :catch_12
    move-exception v0

    invoke-virtual {p0, v0}, Lz9/b$b;->b(Ljava/io/IOException;)Ljava/io/IOException;

    move-result-object v0

    throw v0
.end method

.method public x(Lha/e;J)J
    .registers 11

    const-string v0, "sink"

    invoke-static {p1, v0}, Lx/e;->f(Ljava/lang/Object;Ljava/lang/String;)V

    iget-boolean v0, p0, Lz9/b$b;->v:Z

    xor-int/lit8 v0, v0, 0x1

    if-eqz v0, :cond_70

    .line 1
    :try_start_b
    iget-object v0, p0, Lha/k;->r:Lha/z;

    .line 2
    invoke-interface {v0, p1, p2, p3}, Lha/z;->x(Lha/e;J)J

    move-result-wide p1

    iget-boolean p3, p0, Lz9/b$b;->t:Z

    if-eqz p3, :cond_26

    const/4 p3, 0x0

    iput-boolean p3, p0, Lz9/b$b;->t:Z

    iget-object p3, p0, Lz9/b$b;->x:Lz9/b;

    .line 3
    iget-object v0, p3, Lz9/b;->d:Lv9/r;

    .line 4
    iget-object p3, p3, Lz9/b;->c:Lz9/d;

    .line 5
    invoke-static {v0}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    const-string v0, "call"

    .line 6
    invoke-static {p3, v0}, Lx/e;->f(Ljava/lang/Object;Ljava/lang/String;)V

    :cond_26
    const-wide/16 v0, -0x1

    cmp-long p3, p1, v0

    const/4 v2, 0x0

    if-nez p3, :cond_31

    .line 7
    invoke-virtual {p0, v2}, Lz9/b$b;->b(Ljava/io/IOException;)Ljava/io/IOException;

    return-wide v0

    :cond_31
    iget-wide v3, p0, Lz9/b$b;->s:J

    add-long/2addr v3, p1

    iget-wide v5, p0, Lz9/b$b;->w:J

    cmp-long p3, v5, v0

    if-eqz p3, :cond_60

    cmp-long p3, v3, v5

    if-gtz p3, :cond_3f

    goto :goto_60

    :cond_3f
    new-instance p1, Ljava/net/ProtocolException;

    new-instance p2, Ljava/lang/StringBuilder;

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

    const-string p3, "expected "

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

    iget-wide v0, p0, Lz9/b$b;->w:J

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

    const-string p3, " bytes but received "

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

    invoke-virtual {p2, v3, v4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

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

    move-result-object p2

    invoke-direct {p1, p2}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V

    throw p1

    :cond_60
    :goto_60
    iput-wide v3, p0, Lz9/b$b;->s:J

    cmp-long p3, v3, v5

    if-nez p3, :cond_69

    invoke-virtual {p0, v2}, Lz9/b$b;->b(Ljava/io/IOException;)Ljava/io/IOException;
    :try_end_69
    .catch Ljava/io/IOException; {:try_start_b .. :try_end_69} :catch_6a

    :cond_69
    return-wide p1

    :catch_6a
    move-exception p1

    invoke-virtual {p0, p1}, Lz9/b$b;->b(Ljava/io/IOException;)Ljava/io/IOException;

    move-result-object p1

    throw p1

    :cond_70
    new-instance p1, Ljava/lang/IllegalStateException;

    const-string p2, "closed"

    invoke-virtual {p2}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object p2

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

    throw p1
.end method
