j.smali

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

# interfaces
.implements Lokio/s;


# static fields
.field private static synthetic $assertionsDisabled:Z


# instance fields
.field private byI:Z

.field private synthetic byJ:Lcom/squareup/okhttp/internal/framed/h;

.field private final byK:Lokio/d;

.field private final byL:Lokio/d;

.field private final byM:J

.field private closed:Z


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 314
    const-class v0, Lcom/squareup/okhttp/internal/framed/h;

    invoke-virtual {v0}, Ljava/lang/Class;->desiredAssertionStatus()Z

    move-result v0

    if-nez v0, :cond_c

    const/4 v0, 0x1

    :goto_9
    sput-boolean v0, Lcom/squareup/okhttp/internal/framed/j;->$assertionsDisabled:Z

    return-void

    :cond_c
    const/4 v0, 0x0

    goto :goto_9
.end method

.method private constructor <init>(Lcom/squareup/okhttp/internal/framed/h;J)V
    .registers 6

    .prologue
    .line 333
    iput-object p1, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

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

    .line 316
    new-instance v0, Lokio/d;

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

    iput-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byK:Lokio/d;

    .line 319
    new-instance v0, Lokio/d;

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

    iput-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byL:Lokio/d;

    .line 334
    iput-wide p2, p0, Lcom/squareup/okhttp/internal/framed/j;->byM:J

    .line 335
    return-void
.end method

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

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

    return-void
.end method

.method private Hw()V
    .registers 5

    .prologue
    .line 374
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/h;->d(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/k;

    move-result-object v0

    invoke-virtual {v0}, Lcom/squareup/okhttp/internal/framed/k;->enter()V

    .line 376
    :goto_9
    :try_start_9
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byL:Lokio/d;

    .line 4067
    iget-wide v0, v0, Lokio/d;->size:J

    .line 376
    const-wide/16 v2, 0x0

    cmp-long v0, v0, v2

    if-nez v0, :cond_34

    iget-boolean v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byI:Z

    if-nez v0, :cond_34

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

    if-nez v0, :cond_34

    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/h;->e(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/ErrorCode;

    move-result-object v0

    if-nez v0, :cond_34

    .line 377
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/h;->f(Lcom/squareup/okhttp/internal/framed/h;)V
    :try_end_28
    .catchall {:try_start_9 .. :try_end_28} :catchall_29

    goto :goto_9

    .line 380
    :catchall_29
    move-exception v0

    iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v1}, Lcom/squareup/okhttp/internal/framed/h;->d(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/k;

    move-result-object v1

    invoke-virtual {v1}, Lcom/squareup/okhttp/internal/framed/k;->Hy()V

    throw v0

    :cond_34
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/h;->d(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/k;

    move-result-object v0

    invoke-virtual {v0}, Lcom/squareup/okhttp/internal/framed/k;->Hy()V

    .line 381
    return-void
.end method

.method static synthetic a(Lcom/squareup/okhttp/internal/framed/j;)Z
    .registers 2

    .prologue
    .line 314
    iget-boolean v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byI:Z

    return v0
.end method

.method static synthetic a(Lcom/squareup/okhttp/internal/framed/j;Z)Z
    .registers 2

    .prologue
    .line 314
    iput-boolean p1, p0, Lcom/squareup/okhttp/internal/framed/j;->byI:Z

    return p1
.end method

.method static synthetic b(Lcom/squareup/okhttp/internal/framed/j;)Z
    .registers 2

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

    return v0
.end method


# virtual methods
.method final a(Lokio/f;J)V
    .registers 16

    .prologue
    const-wide/16 v10, 0x0

    const/4 v1, 0x1

    const/4 v2, 0x0

    .line 385
    sget-boolean v0, Lcom/squareup/okhttp/internal/framed/j;->$assertionsDisabled:Z

    if-nez v0, :cond_32

    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v0}, Ljava/lang/Thread;->holdsLock(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_32

    new-instance v0, Ljava/lang/AssertionError;

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

    throw v0

    .line 411
    :cond_16
    sub-long/2addr p2, v4

    .line 414
    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    monitor-enter v3

    .line 415
    :try_start_1a
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byL:Lokio/d;

    .line 6067
    iget-wide v4, v0, Lokio/d;->size:J

    .line 415
    cmp-long v0, v4, v10

    if-nez v0, :cond_72

    move v0, v1

    .line 416
    :goto_23
    iget-object v4, p0, Lcom/squareup/okhttp/internal/framed/j;->byL:Lokio/d;

    iget-object v5, p0, Lcom/squareup/okhttp/internal/framed/j;->byK:Lokio/d;

    invoke-virtual {v4, v5}, Lokio/d;->a(Lokio/s;)J

    .line 417
    if-eqz v0, :cond_31

    .line 418
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 420
    :cond_31
    monitor-exit v3
    :try_end_32
    .catchall {:try_start_1a .. :try_end_32} :catchall_74

    .line 387
    :cond_32
    cmp-long v0, p2, v10

    if-lez v0, :cond_54

    .line 390
    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    monitor-enter v3

    .line 391
    :try_start_39
    iget-boolean v4, p0, Lcom/squareup/okhttp/internal/framed/j;->byI:Z

    .line 392
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byL:Lokio/d;

    .line 5067
    iget-wide v6, v0, Lokio/d;->size:J

    .line 392
    add-long/2addr v6, p2

    iget-wide v8, p0, Lcom/squareup/okhttp/internal/framed/j;->byM:J

    cmp-long v0, v6, v8

    if-lez v0, :cond_55

    move v0, v1

    .line 393
    :goto_47
    monitor-exit v3
    :try_end_48
    .catchall {:try_start_39 .. :try_end_48} :catchall_57

    .line 396
    if-eqz v0, :cond_5a

    .line 397
    invoke-interface {p1, p2, p3}, Lokio/f;->Y(J)V

    .line 398
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    sget-object v1, Lcom/squareup/okhttp/internal/framed/ErrorCode;->FLOW_CONTROL_ERROR:Lcom/squareup/okhttp/internal/framed/ErrorCode;

    invoke-virtual {v0, v1}, Lcom/squareup/okhttp/internal/framed/h;->b(Lcom/squareup/okhttp/internal/framed/ErrorCode;)V

    .line 422
    :cond_54
    :goto_54
    return-void

    :cond_55
    move v0, v2

    .line 392
    goto :goto_47

    .line 393
    :catchall_57
    move-exception v0

    :try_start_58
    monitor-exit v3
    :try_end_59
    .catchall {:try_start_58 .. :try_end_59} :catchall_57

    throw v0

    .line 403
    :cond_5a
    if-eqz v4, :cond_60

    .line 404
    invoke-interface {p1, p2, p3}, Lokio/f;->Y(J)V

    goto :goto_54

    .line 409
    :cond_60
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byK:Lokio/d;

    invoke-interface {p1, v0, p2, p3}, Lokio/f;->read(Lokio/d;J)J

    move-result-wide v4

    .line 410
    const-wide/16 v6, -0x1

    cmp-long v0, v4, v6

    if-nez v0, :cond_16

    new-instance v0, Ljava/io/EOFException;

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

    throw v0

    :cond_72
    move v0, v2

    .line 415
    goto :goto_23

    .line 420
    :catchall_74
    move-exception v0

    :try_start_75
    monitor-exit v3
    :try_end_76
    .catchall {:try_start_75 .. :try_end_76} :catchall_74

    throw v0
.end method

.method public final close()V
    .registers 3

    .prologue
    .line 429
    iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    monitor-enter v1

    .line 430
    const/4 v0, 0x1

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

    .line 431
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byL:Lokio/d;

    invoke-virtual {v0}, Lokio/d;->clear()V

    .line 432
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 433
    monitor-exit v1
    :try_end_11
    .catchall {:try_start_4 .. :try_end_11} :catchall_17

    .line 434
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/h;->g(Lcom/squareup/okhttp/internal/framed/h;)V

    .line 435
    return-void

    .line 433
    :catchall_17
    move-exception v0

    :try_start_18
    monitor-exit v1
    :try_end_19
    .catchall {:try_start_18 .. :try_end_19} :catchall_17

    throw v0
.end method

.method public final read(Lokio/d;J)J
    .registers 12

    .prologue
    const-wide/16 v4, 0x0

    .line 339
    cmp-long v0, p2, v4

    if-gez v0, :cond_1b

    new-instance v0, Ljava/lang/IllegalArgumentException;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "byteCount < 0: "

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

    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/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 342
    :cond_1b
    iget-object v2, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    monitor-enter v2

    .line 343
    :try_start_1e
    invoke-direct {p0}, Lcom/squareup/okhttp/internal/framed/j;->Hw()V

    .line 1438
    iget-boolean v0, p0, Lcom/squareup/okhttp/internal/framed/j;->closed:Z

    if-eqz v0, :cond_30

    .line 1439
    new-instance v0, Ljava/io/IOException;

    const-string v1, "stream closed"

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

    throw v0

    .line 357
    :catchall_2d
    move-exception v0

    monitor-exit v2
    :try_end_2f
    .catchall {:try_start_1e .. :try_end_2f} :catchall_2d

    throw v0

    .line 1441
    :cond_30
    :try_start_30
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/h;->e(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/ErrorCode;

    move-result-object v0

    if-eqz v0, :cond_53

    .line 1442
    new-instance v0, Ljava/io/IOException;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v3, "stream was reset: "

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

    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v3}, Lcom/squareup/okhttp/internal/framed/h;->e(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/ErrorCode;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)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/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 345
    :cond_53
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byL:Lokio/d;

    .line 2067
    iget-wide v0, v0, Lokio/d;->size:J

    .line 345
    cmp-long v0, v0, v4

    if-nez v0, :cond_5f

    const-wide/16 v0, -0x1

    monitor-exit v2

    .line 369
    :goto_5e
    return-wide v0

    .line 348
    :cond_5f
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byL:Lokio/d;

    iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/j;->byL:Lokio/d;

    .line 3067
    iget-wide v4, v1, Lokio/d;->size:J

    .line 348
    invoke-static {p2, p3, v4, v5}, Ljava/lang/Math;->min(JJ)J

    move-result-wide v4

    invoke-virtual {v0, p1, v4, v5}, Lokio/d;->read(Lokio/d;J)J

    move-result-wide v0

    .line 351
    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    iget-wide v4, v3, Lcom/squareup/okhttp/internal/framed/h;->byb:J

    add-long/2addr v4, v0

    iput-wide v4, v3, Lcom/squareup/okhttp/internal/framed/h;->byb:J

    .line 352
    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    iget-wide v4, v3, Lcom/squareup/okhttp/internal/framed/h;->byb:J

    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    .line 353
    invoke-static {v3}, Lcom/squareup/okhttp/internal/framed/h;->b(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/d;

    move-result-object v3

    iget-object v3, v3, Lcom/squareup/okhttp/internal/framed/d;->byd:Lcom/squareup/okhttp/internal/framed/z;

    invoke-virtual {v3}, Lcom/squareup/okhttp/internal/framed/z;->HM()I

    move-result v3

    div-int/lit8 v3, v3, 0x2

    int-to-long v6, v3

    cmp-long v3, v4, v6

    if-ltz v3, :cond_a4

    .line 354
    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v3}, Lcom/squareup/okhttp/internal/framed/h;->b(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/d;

    move-result-object v3

    iget-object v4, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v4}, Lcom/squareup/okhttp/internal/framed/h;->c(Lcom/squareup/okhttp/internal/framed/h;)I

    move-result v4

    iget-object v5, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    iget-wide v6, v5, Lcom/squareup/okhttp/internal/framed/h;->byb:J

    invoke-virtual {v3, v4, v6, v7}, Lcom/squareup/okhttp/internal/framed/d;->g(IJ)V

    .line 355
    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    const-wide/16 v4, 0x0

    iput-wide v4, v3, Lcom/squareup/okhttp/internal/framed/h;->byb:J

    .line 357
    :cond_a4
    monitor-exit v2
    :try_end_a5
    .catchall {:try_start_30 .. :try_end_a5} :catchall_2d

    .line 360
    iget-object v2, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v2}, Lcom/squareup/okhttp/internal/framed/h;->b(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/d;

    move-result-object v2

    monitor-enter v2

    .line 361
    :try_start_ac
    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v3}, Lcom/squareup/okhttp/internal/framed/h;->b(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/d;

    move-result-object v3

    iget-wide v4, v3, Lcom/squareup/okhttp/internal/framed/d;->byb:J

    add-long/2addr v4, v0

    iput-wide v4, v3, Lcom/squareup/okhttp/internal/framed/d;->byb:J

    .line 362
    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v3}, Lcom/squareup/okhttp/internal/framed/h;->b(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/d;

    move-result-object v3

    iget-wide v4, v3, Lcom/squareup/okhttp/internal/framed/d;->byb:J

    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    .line 363
    invoke-static {v3}, Lcom/squareup/okhttp/internal/framed/h;->b(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/d;

    move-result-object v3

    iget-object v3, v3, Lcom/squareup/okhttp/internal/framed/d;->byd:Lcom/squareup/okhttp/internal/framed/z;

    invoke-virtual {v3}, Lcom/squareup/okhttp/internal/framed/z;->HM()I

    move-result v3

    div-int/lit8 v3, v3, 0x2

    int-to-long v6, v3

    cmp-long v3, v4, v6

    if-ltz v3, :cond_ee

    .line 364
    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v3}, Lcom/squareup/okhttp/internal/framed/h;->b(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/d;

    move-result-object v3

    const/4 v4, 0x0

    iget-object v5, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v5}, Lcom/squareup/okhttp/internal/framed/h;->b(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/d;

    move-result-object v5

    iget-wide v6, v5, Lcom/squareup/okhttp/internal/framed/d;->byb:J

    invoke-virtual {v3, v4, v6, v7}, Lcom/squareup/okhttp/internal/framed/d;->g(IJ)V

    .line 365
    iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v3}, Lcom/squareup/okhttp/internal/framed/h;->b(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/d;

    move-result-object v3

    const-wide/16 v4, 0x0

    iput-wide v4, v3, Lcom/squareup/okhttp/internal/framed/d;->byb:J

    .line 367
    :cond_ee
    monitor-exit v2

    goto/16 :goto_5e

    :catchall_f1
    move-exception v0

    monitor-exit v2
    :try_end_f3
    .catchall {:try_start_ac .. :try_end_f3} :catchall_f1

    throw v0
.end method

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

    .prologue
    .line 425
    iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/j;->byJ:Lcom/squareup/okhttp/internal/framed/h;

    invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/h;->d(Lcom/squareup/okhttp/internal/framed/h;)Lcom/squareup/okhttp/internal/framed/k;

    move-result-object v0

    return-object v0
.end method