FramedStream$FramedDataSink.smali
.class final Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;
.super Ljava/lang/Object;
.source "FramedStream.java"
# interfaces
.implements Lokio/Sink;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/squareup/okhttp/internal/framed/FramedStream;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x10
name = "FramedDataSink"
.end annotation
# static fields
.field static final synthetic $assertionsDisabled:Z = false
.field private static final EMIT_BUFFER_SIZE:J = 0x4000L
# instance fields
.field private closed:Z
.field private finished:Z
.field private final sendBuffer:Lokio/Buffer;
.field final synthetic this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# direct methods
.method static constructor <clinit>()V
.registers 0
return-void
.end method
.method constructor <init>(Lcom/squareup/okhttp/internal/framed/FramedStream;)V
.registers 2
.line 1
iput-object p1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 2
new-instance p1, Lokio/Buffer;
invoke-direct {p1}, Lokio/Buffer;-><init>()V
iput-object p1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->sendBuffer:Lokio/Buffer;
return-void
.end method
.method static synthetic access$200(Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;)Z
.registers 1
.line 1
iget-boolean p0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->finished:Z
return p0
.end method
.method static synthetic access$202(Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;Z)Z
.registers 2
.line 1
iput-boolean p1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->finished:Z
return p1
.end method
.method static synthetic access$400(Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;)Z
.registers 1
.line 1
iget-boolean p0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->closed:Z
return p0
.end method
.method private emitDataFrame(Z)V
.registers 13
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
monitor-enter v0
.line 2
:try_start_3
iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->writeTimeout:Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
invoke-static {v1}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$1100(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
move-result-object v1
invoke-virtual {v1}, Lokio/AsyncTimeout;->enter()V
:try_end_c
.catchall {:try_start_3 .. :try_end_c} :catchall_9b
.line 3
:goto_c
:try_start_c
iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
iget-wide v1, v1, Lcom/squareup/okhttp/internal/framed/FramedStream;->bytesLeftInWriteWindow:J
const-wide/16 v3, 0x0
cmp-long v5, v1, v3
if-gtz v5, :cond_2c
iget-boolean v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->finished:Z
if-nez v1, :cond_2c
iget-boolean v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->closed:Z
if-nez v1, :cond_2c
iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->errorCode:Lcom/squareup/okhttp/internal/framed/ErrorCode;
invoke-static {v1}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$800(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/ErrorCode;
move-result-object v1
if-nez v1, :cond_2c
.line 4
iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# invokes: Lcom/squareup/okhttp/internal/framed/FramedStream;->waitForIo()V
invoke-static {v1}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$900(Lcom/squareup/okhttp/internal/framed/FramedStream;)V
:try_end_2b
.catchall {:try_start_c .. :try_end_2b} :catchall_90
goto :goto_c
.line 5
:cond_2c
:try_start_2c
iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->writeTimeout:Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
invoke-static {v1}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$1100(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
move-result-object v1
invoke-virtual {v1}, Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;->exitAndThrowIfTimedOut()V
.line 6
iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# invokes: Lcom/squareup/okhttp/internal/framed/FramedStream;->checkOutNotClosed()V
invoke-static {v1}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$1200(Lcom/squareup/okhttp/internal/framed/FramedStream;)V
.line 7
iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
iget-wide v1, v1, Lcom/squareup/okhttp/internal/framed/FramedStream;->bytesLeftInWriteWindow:J
iget-object v3, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->sendBuffer:Lokio/Buffer;
invoke-virtual {v3}, Lokio/Buffer;->size()J
move-result-wide v3
invoke-static {v1, v2, v3, v4}, Ljava/lang/Math;->min(JJ)J
move-result-wide v9
.line 8
iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
iget-wide v2, v1, Lcom/squareup/okhttp/internal/framed/FramedStream;->bytesLeftInWriteWindow:J
sub-long/2addr v2, v9
iput-wide v2, v1, Lcom/squareup/okhttp/internal/framed/FramedStream;->bytesLeftInWriteWindow:J
.line 9
monitor-exit v0
:try_end_50
.catchall {:try_start_2c .. :try_end_50} :catchall_9b
.line 10
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->writeTimeout:Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$1100(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
move-result-object v0
invoke-virtual {v0}, Lokio/AsyncTimeout;->enter()V
.line 11
:try_start_59
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->connection:Lcom/squareup/okhttp/internal/framed/FramedConnection;
invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$500(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/FramedConnection;
move-result-object v5
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->id:I
invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$600(Lcom/squareup/okhttp/internal/framed/FramedStream;)I
move-result v6
if-eqz p1, :cond_74
iget-object p1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->sendBuffer:Lokio/Buffer;
invoke-virtual {p1}, Lokio/Buffer;->size()J
move-result-wide v0
cmp-long p1, v9, v0
if-nez p1, :cond_74
const/4 p1, 0x1
const/4 v7, 0x1
goto :goto_76
:cond_74
const/4 p1, 0x0
const/4 v7, 0x0
:goto_76
iget-object v8, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->sendBuffer:Lokio/Buffer;
invoke-virtual/range {v5 .. v10}, Lcom/squareup/okhttp/internal/framed/FramedConnection;->writeData(IZLokio/Buffer;J)V
:try_end_7b
.catchall {:try_start_59 .. :try_end_7b} :catchall_85
.line 12
iget-object p1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->writeTimeout:Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
invoke-static {p1}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$1100(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
move-result-object p1
invoke-virtual {p1}, Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;->exitAndThrowIfTimedOut()V
return-void
:catchall_85
move-exception p1
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->writeTimeout:Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$1100(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
move-result-object v0
invoke-virtual {v0}, Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;->exitAndThrowIfTimedOut()V
throw p1
:catchall_90
move-exception p1
.line 13
:try_start_91
iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->writeTimeout:Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
invoke-static {v1}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$1100(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
move-result-object v1
invoke-virtual {v1}, Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;->exitAndThrowIfTimedOut()V
throw p1
:catchall_9b
move-exception p1
.line 14
monitor-exit v0
:try_end_9d
.catchall {:try_start_91 .. :try_end_9d} :catchall_9b
goto :goto_9f
:goto_9e
throw p1
:goto_9f
goto :goto_9e
.end method
# virtual methods
.method public close()V
.registers 9
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
monitor-enter v0
.line 2
:try_start_3
iget-boolean v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->closed:Z
if-eqz v1, :cond_9
monitor-exit v0
return-void
.line 3
:cond_9
monitor-exit v0
:try_end_a
.catchall {:try_start_3 .. :try_end_a} :catchall_58
.line 4
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
iget-object v0, v0, Lcom/squareup/okhttp/internal/framed/FramedStream;->sink:Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;
iget-boolean v0, v0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->finished:Z
const/4 v1, 0x1
if-nez v0, :cond_40
.line 5
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->sendBuffer:Lokio/Buffer;
invoke-virtual {v0}, Lokio/Buffer;->size()J
move-result-wide v2
const-wide/16 v4, 0x0
cmp-long v0, v2, v4
if-lez v0, :cond_2d
.line 6
:goto_1f
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->sendBuffer:Lokio/Buffer;
invoke-virtual {v0}, Lokio/Buffer;->size()J
move-result-wide v2
cmp-long v0, v2, v4
if-lez v0, :cond_40
.line 7
invoke-direct {p0, v1}, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->emitDataFrame(Z)V
goto :goto_1f
.line 8
:cond_2d
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->connection:Lcom/squareup/okhttp/internal/framed/FramedConnection;
invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$500(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/FramedConnection;
move-result-object v2
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->id:I
invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$600(Lcom/squareup/okhttp/internal/framed/FramedStream;)I
move-result v3
const/4 v4, 0x1
const/4 v5, 0x0
const-wide/16 v6, 0x0
invoke-virtual/range {v2 .. v7}, Lcom/squareup/okhttp/internal/framed/FramedConnection;->writeData(IZLokio/Buffer;J)V
.line 9
:cond_40
iget-object v2, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
monitor-enter v2
.line 10
:try_start_43
iput-boolean v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->closed:Z
.line 11
monitor-exit v2
:try_end_46
.catchall {:try_start_43 .. :try_end_46} :catchall_55
.line 12
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->connection:Lcom/squareup/okhttp/internal/framed/FramedConnection;
invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$500(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/FramedConnection;
move-result-object v0
invoke-virtual {v0}, Lcom/squareup/okhttp/internal/framed/FramedConnection;->flush()V
.line 13
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# invokes: Lcom/squareup/okhttp/internal/framed/FramedStream;->cancelStreamIfNecessary()V
invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$1000(Lcom/squareup/okhttp/internal/framed/FramedStream;)V
return-void
:catchall_55
move-exception v0
.line 14
:try_start_56
monitor-exit v2
:try_end_57
.catchall {:try_start_56 .. :try_end_57} :catchall_55
throw v0
:catchall_58
move-exception v1
.line 15
:try_start_59
monitor-exit v0
:try_end_5a
.catchall {:try_start_59 .. :try_end_5a} :catchall_58
goto :goto_5c
:goto_5b
throw v1
:goto_5c
goto :goto_5b
.end method
.method public flush()V
.registers 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
monitor-enter v0
.line 2
:try_start_3
iget-object v1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# invokes: Lcom/squareup/okhttp/internal/framed/FramedStream;->checkOutNotClosed()V
invoke-static {v1}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$1200(Lcom/squareup/okhttp/internal/framed/FramedStream;)V
.line 3
monitor-exit v0
:try_end_9
.catchall {:try_start_3 .. :try_end_9} :catchall_24
.line 4
:goto_9
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->sendBuffer:Lokio/Buffer;
invoke-virtual {v0}, Lokio/Buffer;->size()J
move-result-wide v0
const-wide/16 v2, 0x0
cmp-long v4, v0, v2
if-lez v4, :cond_23
const/4 v0, 0x0
.line 5
invoke-direct {p0, v0}, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->emitDataFrame(Z)V
.line 6
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->connection:Lcom/squareup/okhttp/internal/framed/FramedConnection;
invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$500(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/FramedConnection;
move-result-object v0
invoke-virtual {v0}, Lcom/squareup/okhttp/internal/framed/FramedConnection;->flush()V
goto :goto_9
:cond_23
return-void
:catchall_24
move-exception v1
.line 7
:try_start_25
monitor-exit v0
:try_end_26
.catchall {:try_start_25 .. :try_end_26} :catchall_24
goto :goto_28
:goto_27
throw v1
:goto_28
goto :goto_27
.end method
.method public timeout()Lokio/Timeout;
.registers 2
.line 1
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->this$0:Lcom/squareup/okhttp/internal/framed/FramedStream;
# getter for: Lcom/squareup/okhttp/internal/framed/FramedStream;->writeTimeout:Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
invoke-static {v0}, Lcom/squareup/okhttp/internal/framed/FramedStream;->access$1100(Lcom/squareup/okhttp/internal/framed/FramedStream;)Lcom/squareup/okhttp/internal/framed/FramedStream$StreamTimeout;
move-result-object v0
return-object v0
.end method
.method public write(Lokio/Buffer;J)V
.registers 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-object v0, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->sendBuffer:Lokio/Buffer;
invoke-virtual {v0, p1, p2, p3}, Lokio/Buffer;->write(Lokio/Buffer;J)V
.line 2
:goto_5
iget-object p1, p0, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->sendBuffer:Lokio/Buffer;
invoke-virtual {p1}, Lokio/Buffer;->size()J
move-result-wide p1
const-wide/16 v0, 0x4000
cmp-long p3, p1, v0
if-ltz p3, :cond_16
const/4 p1, 0x0
.line 3
invoke-direct {p0, p1}, Lcom/squareup/okhttp/internal/framed/FramedStream$FramedDataSink;->emitDataFrame(Z)V
goto :goto_5
:cond_16
return-void
.end method