j.smali

.class final Lcom/squareup/okhttp/internal/http/j;
.super Ljava/lang/Object;
.source "Http1xStream.java"

# interfaces
.implements Lokio/r;


# instance fields
.field private bAc:J

.field private final bzY:Lokio/j;

.field private synthetic bzZ:Lcom/squareup/okhttp/internal/http/f;

.field private closed:Z


# direct methods
.method private constructor <init>(Lcom/squareup/okhttp/internal/http/f;J)V
    .registers 6

    .prologue
    .line 273
    iput-object p1, p0, Lcom/squareup/okhttp/internal/http/j;->bzZ:Lcom/squareup/okhttp/internal/http/f;

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

    .line 269
    new-instance v0, Lokio/j;

    iget-object v1, p0, Lcom/squareup/okhttp/internal/http/j;->bzZ:Lcom/squareup/okhttp/internal/http/f;

    .line 1061
    iget-object v1, v1, Lcom/squareup/okhttp/internal/http/f;->byu:Lokio/e;

    .line 269
    invoke-interface {v1}, Lokio/e;->timeout()Lokio/t;

    move-result-object v1

    invoke-direct {v0, v1}, Lokio/j;-><init>(Lokio/t;)V

    iput-object v0, p0, Lcom/squareup/okhttp/internal/http/j;->bzY:Lokio/j;

    .line 274
    iput-wide p2, p0, Lcom/squareup/okhttp/internal/http/j;->bAc:J

    .line 275
    return-void
.end method

.method synthetic constructor <init>(Lcom/squareup/okhttp/internal/http/f;JB)V
    .registers 5

    .prologue
    .line 268
    invoke-direct {p0, p1, p2, p3}, Lcom/squareup/okhttp/internal/http/j;-><init>(Lcom/squareup/okhttp/internal/http/f;J)V

    return-void
.end method


# virtual methods
.method public final a(Lokio/d;J)V
    .registers 8

    .prologue
    .line 282
    iget-boolean v0, p0, Lcom/squareup/okhttp/internal/http/j;->closed:Z

    if-eqz v0, :cond_c

    new-instance v0, Ljava/lang/IllegalStateException;

    const-string v1, "closed"

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

    throw v0

    .line 1067
    :cond_c
    iget-wide v0, p1, Lokio/d;->size:J

    .line 283
    invoke-static {v0, v1, p2, p3}, Lcom/squareup/okhttp/internal/k;->e(JJ)V

    .line 284
    iget-wide v0, p0, Lcom/squareup/okhttp/internal/http/j;->bAc:J

    cmp-long v0, p2, v0

    if-lez v0, :cond_38

    .line 285
    new-instance v0, Ljava/net/ProtocolException;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "expected "

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

    iget-wide v2, p0, Lcom/squareup/okhttp/internal/http/j;->bAc:J

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

    move-result-object v1

    const-string v2, " bytes but received "

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

    move-result-object v1

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

    move-result-object v1

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

    move-result-object v1

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

    throw v0

    .line 288
    :cond_38
    iget-object v0, p0, Lcom/squareup/okhttp/internal/http/j;->bzZ:Lcom/squareup/okhttp/internal/http/f;

    .line 2061
    iget-object v0, v0, Lcom/squareup/okhttp/internal/http/f;->byu:Lokio/e;

    .line 288
    invoke-interface {v0, p1, p2, p3}, Lokio/e;->a(Lokio/d;J)V

    .line 289
    iget-wide v0, p0, Lcom/squareup/okhttp/internal/http/j;->bAc:J

    sub-long/2addr v0, p2

    iput-wide v0, p0, Lcom/squareup/okhttp/internal/http/j;->bAc:J

    .line 290
    return-void
.end method

.method public final close()V
    .registers 5

    .prologue
    .line 298
    iget-boolean v0, p0, Lcom/squareup/okhttp/internal/http/j;->closed:Z

    if-eqz v0, :cond_5

    .line 303
    :goto_4
    return-void

    .line 299
    :cond_5
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/squareup/okhttp/internal/http/j;->closed:Z

    .line 300
    iget-wide v0, p0, Lcom/squareup/okhttp/internal/http/j;->bAc:J

    const-wide/16 v2, 0x0

    cmp-long v0, v0, v2

    if-lez v0, :cond_18

    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 301
    :cond_18
    iget-object v0, p0, Lcom/squareup/okhttp/internal/http/j;->bzY:Lokio/j;

    invoke-static {v0}, Lcom/squareup/okhttp/internal/http/f;->a(Lokio/j;)V

    .line 302
    iget-object v0, p0, Lcom/squareup/okhttp/internal/http/j;->bzZ:Lcom/squareup/okhttp/internal/http/f;

    .line 4061
    const/4 v1, 0x3

    iput v1, v0, Lcom/squareup/okhttp/internal/http/f;->state:I

    goto :goto_4
.end method

.method public final flush()V
    .registers 2

    .prologue
    .line 293
    iget-boolean v0, p0, Lcom/squareup/okhttp/internal/http/j;->closed:Z

    if-eqz v0, :cond_5

    .line 295
    :goto_4
    return-void

    .line 294
    :cond_5
    iget-object v0, p0, Lcom/squareup/okhttp/internal/http/j;->bzZ:Lcom/squareup/okhttp/internal/http/f;

    .line 3061
    iget-object v0, v0, Lcom/squareup/okhttp/internal/http/f;->byu:Lokio/e;

    .line 294
    invoke-interface {v0}, Lokio/e;->flush()V

    goto :goto_4
.end method

.method public final timeout()Lokio/t;
    .registers 2

    .prologue
    .line 278
    iget-object v0, p0, Lcom/squareup/okhttp/internal/http/j;->bzY:Lokio/j;

    return-object v0
.end method