OutputStreamRequestBody$1.smali
.class Lokhttp3/internal/huc/OutputStreamRequestBody$1;
.super Ljava/io/OutputStream;
.source "SourceFile"
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lokhttp3/internal/huc/OutputStreamRequestBody;->initOutputStream(Lokio/c;J)V
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x1
name = null
.end annotation
# instance fields
.field private bytesReceived:J
.field public final synthetic this$0:Lokhttp3/internal/huc/OutputStreamRequestBody;
.field public final synthetic val$expectedContentLength:J
.field public final synthetic val$sink:Lokio/c;
# direct methods
.method public constructor <init>(Lokhttp3/internal/huc/OutputStreamRequestBody;JLokio/c;)V
.registers 5
iput-object p1, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->this$0:Lokhttp3/internal/huc/OutputStreamRequestBody;
iput-wide p2, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->val$expectedContentLength:J
iput-object p4, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->val$sink:Lokio/c;
invoke-direct {p0}, Ljava/io/OutputStream;-><init>()V
return-void
.end method
# virtual methods
.method public close()V
.registers 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-object v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->this$0:Lokhttp3/internal/huc/OutputStreamRequestBody;
const/4 v1, 0x1
iput-boolean v1, v0, Lokhttp3/internal/huc/OutputStreamRequestBody;->closed:Z
.line 2
iget-wide v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->val$expectedContentLength:J
const-wide/16 v2, -0x1
cmp-long v4, v0, v2
if-eqz v4, :cond_33
iget-wide v2, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->bytesReceived:J
cmp-long v4, v2, v0
if-ltz v4, :cond_14
goto :goto_33
.line 3
:cond_14
new-instance v0, Ljava/net/ProtocolException;
const-string v1, "expected "
.line 4
invoke-static {v1}, Landroid/support/v4/media/c;->c(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
.line 5
iget-wide v2, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->val$expectedContentLength:J
invoke-virtual {v1, v2, v3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
const-string v2, " bytes but received "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
iget-wide v2, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->bytesReceived:J
invoke-virtual {v1, v2, v3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
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 6
:cond_33
:goto_33
iget-object v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->val$sink:Lokio/c;
invoke-interface {v0}, Lokio/v;->close()V
return-void
.end method
.method public flush()V
.registers 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget-object v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->this$0:Lokhttp3/internal/huc/OutputStreamRequestBody;
iget-boolean v0, v0, Lokhttp3/internal/huc/OutputStreamRequestBody;->closed:Z
if-eqz v0, :cond_7
return-void
.line 2
:cond_7
iget-object v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->val$sink:Lokio/c;
invoke-interface {v0}, Lokio/c;->flush()V
return-void
.end method
.method public write(I)V
.registers 5
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const/4 v0, 0x1
new-array v1, v0, [B
int-to-byte p1, p1
const/4 v2, 0x0
aput-byte p1, v1, v2
.line 1
invoke-virtual {p0, v1, v2, v0}, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->write([BII)V
return-void
.end method
.method public write([BII)V
.registers 10
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 2
iget-object v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->this$0:Lokhttp3/internal/huc/OutputStreamRequestBody;
iget-boolean v0, v0, Lokhttp3/internal/huc/OutputStreamRequestBody;->closed:Z
if-nez v0, :cond_50
.line 3
iget-wide v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->val$expectedContentLength:J
const-wide/16 v2, -0x1
cmp-long v4, v0, v2
if-eqz v4, :cond_39
iget-wide v2, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->bytesReceived:J
int-to-long v4, p3
add-long/2addr v2, v4
cmp-long v4, v2, v0
if-gtz v4, :cond_17
goto :goto_39
.line 4
:cond_17
new-instance p1, Ljava/net/ProtocolException;
const-string p2, "expected "
.line 5
invoke-static {p2}, Landroid/support/v4/media/c;->c(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p2
.line 6
iget-wide v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->val$expectedContentLength:J
invoke-virtual {p2, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
const-string v0, " bytes but received "
invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
iget-wide v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->bytesReceived:J
invoke-virtual {p2, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
invoke-virtual {p2}, 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 7
:cond_39
:goto_39
iget-wide v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->bytesReceived:J
int-to-long v2, p3
add-long/2addr v0, v2
iput-wide v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->bytesReceived:J
.line 8
:try_start_3f
iget-object v0, p0, Lokhttp3/internal/huc/OutputStreamRequestBody$1;->val$sink:Lokio/c;
invoke-interface {v0, p1, p2, p3}, Lokio/c;->b([BII)Lokio/c;
:try_end_44
.catch Ljava/io/InterruptedIOException; {:try_start_3f .. :try_end_44} :catch_45
return-void
:catch_45
move-exception p1
.line 9
new-instance p2, Ljava/net/SocketTimeoutException;
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-direct {p2, p1}, Ljava/net/SocketTimeoutException;-><init>(Ljava/lang/String;)V
throw p2
.line 10
:cond_50
new-instance p1, Ljava/io/IOException;
const-string p2, "closed"
invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw p1
.end method