.class public final Lba/b$d;
.super Lba/b$a;
.source ""


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

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


# instance fields
.field public u:J

.field public final synthetic v:Lba/b;


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

    iput-object p1, p0, Lba/b$d;->v:Lba/b;

    invoke-direct {p0, p1}, Lba/b$a;-><init>(Lba/b;)V

    iput-wide p2, p0, Lba/b$d;->u:J

    const-wide/16 v0, 0x0

    cmp-long p1, p2, v0

    if-nez p1, :cond_10

    invoke-virtual {p0}, Lba/b$a;->b()V

    :cond_10
    return-void
.end method


# virtual methods
.method public close()V
    .registers 5

    .line 1
    iget-boolean v0, p0, Lba/b$a;->s:Z

    if-eqz v0, :cond_5

    return-void

    .line 2
    :cond_5
    iget-wide v0, p0, Lba/b$d;->u:J

    const-wide/16 v2, 0x0

    cmp-long v0, v0, v2

    if-eqz v0, :cond_21

    const/16 v0, 0x64

    sget-object v1, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;

    invoke-static {p0, v0, v1}, Lw9/c;->h(Lha/z;ILjava/util/concurrent/TimeUnit;)Z

    move-result v0

    if-nez v0, :cond_21

    iget-object v0, p0, Lba/b$d;->v:Lba/b;

    .line 3
    iget-object v0, v0, Lba/b;->e:Lz9/h;

    .line 4
    invoke-virtual {v0}, Lz9/h;->l()V

    invoke-virtual {p0}, Lba/b$a;->b()V

    :cond_21
    const/4 v0, 0x1

    .line 5
    iput-boolean v0, p0, Lba/b$a;->s:Z

    return-void
.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

    const-wide/16 v0, 0x0

    cmp-long v2, p2, v0

    const/4 v3, 0x1

    if-ltz v2, :cond_e

    move v2, v3

    goto :goto_f

    :cond_e
    const/4 v2, 0x0

    :goto_f
    if-eqz v2, :cond_56

    .line 1
    iget-boolean v2, p0, Lba/b$a;->s:Z

    xor-int/2addr v2, v3

    if-eqz v2, :cond_4a

    .line 2
    iget-wide v2, p0, Lba/b$d;->u:J

    cmp-long v4, v2, v0

    const-wide/16 v5, -0x1

    if-nez v4, :cond_1f

    return-wide v5

    :cond_1f
    invoke-static {v2, v3, p2, p3}, Ljava/lang/Math;->min(JJ)J

    move-result-wide p2

    invoke-super {p0, p1, p2, p3}, Lba/b$a;->x(Lha/e;J)J

    move-result-wide p1

    cmp-long p3, p1, v5

    if-eqz p3, :cond_38

    iget-wide v2, p0, Lba/b$d;->u:J

    sub-long/2addr v2, p1

    iput-wide v2, p0, Lba/b$d;->u:J

    cmp-long p3, v2, v0

    if-nez p3, :cond_37

    invoke-virtual {p0}, Lba/b$a;->b()V

    :cond_37
    return-wide p1

    :cond_38
    iget-object p1, p0, Lba/b$d;->v:Lba/b;

    .line 3
    iget-object p1, p1, Lba/b;->e:Lz9/h;

    .line 4
    invoke-virtual {p1}, Lz9/h;->l()V

    new-instance p1, Ljava/net/ProtocolException;

    const-string p2, "unexpected end of stream"

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

    invoke-virtual {p0}, Lba/b$a;->b()V

    throw p1

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

    :cond_56
    const-string p1, "byteCount < 0: "

    invoke-static {p1, p2, p3}, Lv0/a;->a(Ljava/lang/String;J)Ljava/lang/String;

    move-result-object p1

    new-instance p2, Ljava/lang/IllegalArgumentException;

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

    move-result-object p1

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

    throw p2
.end method
