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


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

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


# instance fields
.field public s:Z

.field public t:J

.field public u:Z

.field public final v:J

.field public final synthetic w:Lz9/b;


# direct methods
.method public constructor <init>(Lz9/b;Lha/x;J)V
    .registers 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lha/x;",
            "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$a;->w:Lz9/b;

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

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

    return-void
.end method


# virtual methods
.method public E(Lha/e;J)V
    .registers 9

    const-string v0, "source"

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

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

    xor-int/lit8 v1, v1, 0x1

    if-eqz v1, :cond_4f

    iget-wide v1, p0, Lz9/b$a;->v:J

    const-wide/16 v3, -0x1

    cmp-long v3, v1, v3

    if-eqz v3, :cond_3b

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

    add-long/2addr v3, p2

    cmp-long v1, v3, v1

    if-gtz v1, :cond_1b

    goto :goto_3b

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

    const-string v0, "expected "

    invoke-static {v0}, Landroidx/activity/c;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-wide v1, p0, Lz9/b$a;->v:J

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

    const-string v1, " bytes but received "

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

    iget-wide v1, p0, Lz9/b$a;->t:J

    add-long/2addr v1, p2

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

    invoke-virtual {v0}, 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

    .line 1
    :cond_3b
    :goto_3b
    :try_start_3b
    invoke-static {p1, v0}, Lx/e;->f(Ljava/lang/Object;Ljava/lang/String;)V

    iget-object v0, p0, Lha/j;->r:Lha/x;

    invoke-interface {v0, p1, p2, p3}, Lha/x;->E(Lha/e;J)V

    .line 2
    iget-wide v0, p0, Lz9/b$a;->t:J

    add-long/2addr v0, p2

    iput-wide v0, p0, Lz9/b$a;->t:J
    :try_end_48
    .catch Ljava/io/IOException; {:try_start_3b .. :try_end_48} :catch_49

    return-void

    :catch_49
    move-exception p1

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

    move-result-object p1

    throw p1

    :cond_4f
    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

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

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

    if-eqz v0, :cond_5

    return-object p1

    :cond_5
    const/4 v0, 0x1

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

    iget-object v1, p0, Lz9/b$a;->w:Lz9/b;

    iget-wide v2, p0, Lz9/b$a;->t:J

    const/4 v4, 0x0

    const/4 v5, 0x1

    move-object v6, p1

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

    move-result-object p1

    return-object p1
.end method

.method public close()V
    .registers 5

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

    if-eqz v0, :cond_5

    return-void

    :cond_5
    const/4 v0, 0x1

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

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

    const-wide/16 v2, -0x1

    cmp-long v2, v0, v2

    if-eqz v2, :cond_1f

    iget-wide v2, p0, Lz9/b$a;->t:J

    cmp-long v0, v2, v0

    if-nez v0, :cond_17

    goto :goto_1f

    :cond_17
    new-instance v0, Ljava/net/ProtocolException;

    const-string v1, "unexpected end of stream"

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

    throw v0

    .line 1
    :cond_1f
    :goto_1f
    :try_start_1f
    iget-object v0, p0, Lha/j;->r:Lha/x;

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

    const/4 v0, 0x0

    .line 2
    invoke-virtual {p0, v0}, Lz9/b$a;->b(Ljava/io/IOException;)Ljava/io/IOException;
    :try_end_28
    .catch Ljava/io/IOException; {:try_start_1f .. :try_end_28} :catch_29

    return-void

    :catch_29
    move-exception v0

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

    move-result-object v0

    throw v0
.end method

.method public flush()V
    .registers 2

    .line 1
    :try_start_0
    iget-object v0, p0, Lha/j;->r:Lha/x;

    invoke-interface {v0}, Lha/x;->flush()V
    :try_end_5
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_5} :catch_6

    return-void

    :catch_6
    move-exception v0

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

    move-result-object v0

    throw v0
.end method
