Exchange$ResponseBodySource.smali
.class public final Lokhttp3/internal/connection/Exchange$ResponseBodySource;
.super Lokio/ForwardingSource;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lokhttp3/internal/connection/Exchange;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x11
name = "ResponseBodySource"
.end annotation
# instance fields
.field private g:J
.field private h:Z
.field private i:Z
.field private j:Z
.field private final k:J
.field final synthetic l:Lokhttp3/internal/connection/Exchange;
# direct methods
.method public constructor <init>(Lokhttp3/internal/connection/Exchange;Lokio/Source;J)V
.registers 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lokio/Source;",
"J)V"
}
.end annotation
const-string v0, "delegate"
invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->c(Ljava/lang/Object;Ljava/lang/String;)V
iput-object p1, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->l:Lokhttp3/internal/connection/Exchange;
invoke-direct {p0, p2}, Lokio/ForwardingSource;-><init>(Lokio/Source;)V
iput-wide p3, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->k:J
const/4 p1, 0x1
iput-boolean p1, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->h:Z
const-wide/16 p1, 0x0
cmp-long v0, p3, p1
if-nez v0, :cond_19
const/4 p1, 0x0
invoke-virtual {p0, p1}, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->b(Ljava/io/IOException;)Ljava/io/IOException;
:cond_19
return-void
.end method
# virtual methods
.method public final b(Ljava/io/IOException;)Ljava/io/IOException;
.registers 10
.annotation system Ldalvik/annotation/Signature;
value = {
"<E:",
"Ljava/io/IOException;",
">(TE;)TE;"
}
.end annotation
iget-boolean v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->i:Z
if-eqz v0, :cond_5
return-object p1
:cond_5
const/4 v0, 0x1
iput-boolean v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->i:Z
if-nez p1, :cond_20
iget-boolean v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->h:Z
if-eqz v0, :cond_20
const/4 v0, 0x0
iput-boolean v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->h:Z
iget-object v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->l:Lokhttp3/internal/connection/Exchange;
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->i()Lokhttp3/EventListener;
move-result-object v0
iget-object v1, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->l:Lokhttp3/internal/connection/Exchange;
invoke-virtual {v1}, Lokhttp3/internal/connection/Exchange;->g()Lokhttp3/internal/connection/RealCall;
move-result-object v1
invoke-virtual {v0, v1}, Lokhttp3/EventListener;->w(Lokhttp3/Call;)V
:cond_20
iget-object v2, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->l:Lokhttp3/internal/connection/Exchange;
iget-wide v3, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->g:J
const/4 v5, 0x1
const/4 v6, 0x0
move-object v7, p1
invoke-virtual/range {v2 .. v7}, Lokhttp3/internal/connection/Exchange;->a(JZZLjava/io/IOException;)Ljava/io/IOException;
move-result-object p1
return-object p1
.end method
.method public close()V
.registers 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-boolean v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->j:Z
if-eqz v0, :cond_5
return-void
:cond_5
const/4 v0, 0x1
iput-boolean v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->j:Z
:try_start_8
invoke-super {p0}, Lokio/ForwardingSource;->close()V
const/4 v0, 0x0
invoke-virtual {p0, v0}, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->b(Ljava/io/IOException;)Ljava/io/IOException;
:try_end_f
.catch Ljava/io/IOException; {:try_start_8 .. :try_end_f} :catch_10
return-void
:catch_10
move-exception v0
invoke-virtual {p0, v0}, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->b(Ljava/io/IOException;)Ljava/io/IOException;
move-result-object v0
throw v0
.end method
.method public o1(Lokio/Buffer;J)J
.registers 11
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const-string v0, "sink"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->c(Ljava/lang/Object;Ljava/lang/String;)V
iget-boolean v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->j:Z
xor-int/lit8 v0, v0, 0x1
if-eqz v0, :cond_77
:try_start_b
invoke-virtual {p0}, Lokio/ForwardingSource;->a()Lokio/Source;
move-result-object v0
invoke-interface {v0, p1, p2, p3}, Lokio/Source;->o1(Lokio/Buffer;J)J
move-result-wide p1
iget-boolean p3, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->h:Z
if-eqz p3, :cond_29
const/4 p3, 0x0
iput-boolean p3, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->h:Z
iget-object p3, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->l:Lokhttp3/internal/connection/Exchange;
invoke-virtual {p3}, Lokhttp3/internal/connection/Exchange;->i()Lokhttp3/EventListener;
move-result-object p3
iget-object v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->l:Lokhttp3/internal/connection/Exchange;
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->g()Lokhttp3/internal/connection/RealCall;
move-result-object v0
invoke-virtual {p3, v0}, Lokhttp3/EventListener;->w(Lokhttp3/Call;)V
:cond_29
const/4 p3, 0x0
const-wide/16 v0, -0x1
cmp-long v2, p1, v0
if-nez v2, :cond_34
invoke-virtual {p0, p3}, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->b(Ljava/io/IOException;)Ljava/io/IOException;
return-wide v0
:cond_34
iget-wide v2, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->g:J
add-long/2addr v2, p1
iget-wide v4, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->k:J
cmp-long v6, v4, v0
if-eqz v6, :cond_65
iget-wide v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->k:J
cmp-long v4, v2, v0
if-gtz v4, :cond_44
goto :goto_65
:cond_44
new-instance p1, Ljava/net/ProtocolException;
new-instance p2, Ljava/lang/StringBuilder;
invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
const-string p3, "expected "
invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
iget-wide v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->k:J
invoke-virtual {p2, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
const-string p3, " bytes but received "
invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p2, v2, v3}, Ljava/lang/StringBuilder;->append(J)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
:cond_65
:goto_65
iput-wide v2, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->g:J
iget-wide v0, p0, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->k:J
cmp-long v4, v2, v0
if-nez v4, :cond_70
invoke-virtual {p0, p3}, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->b(Ljava/io/IOException;)Ljava/io/IOException;
:try_end_70
.catch Ljava/io/IOException; {:try_start_b .. :try_end_70} :catch_71
:cond_70
return-wide p1
:catch_71
move-exception p1
invoke-virtual {p0, p1}, Lokhttp3/internal/connection/Exchange$ResponseBodySource;->b(Ljava/io/IOException;)Ljava/io/IOException;
move-result-object p1
throw p1
:cond_77
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
.end method