2022-06-10 21:38:30 +09:00

415 lines
8.4 KiB
Smali

.class public abstract Lcom/loopj/android/http/w;
.super Lcom/loopj/android/http/k;
.source "RangeFileAsyncHttpResponseHandler.java"
# static fields
.field public static final A:Ljava/lang/String; = "RangeFileAsyncHttpRH"
# instance fields
.field public y:J
.field public z:Z
# direct methods
.method public constructor <init>(Ljava/io/File;)V
.locals 2
.line 1
invoke-direct {p0, p1}, Lcom/loopj/android/http/k;-><init>(Ljava/io/File;)V
const-wide/16 v0, 0x0
.line 2
iput-wide v0, p0, Lcom/loopj/android/http/w;->y:J
const/4 p1, 0x0
.line 3
iput-boolean p1, p0, Lcom/loopj/android/http/w;->z:Z
return-void
.end method
# virtual methods
.method public P(Lkf/q;)V
.locals 4
.line 1
iget-object v0, p0, Lcom/loopj/android/http/k;->t:Ljava/io/File;
invoke-virtual {v0}, Ljava/io/File;->exists()Z
move-result v0
if-eqz v0, :cond_0
iget-object v0, p0, Lcom/loopj/android/http/k;->t:Ljava/io/File;
invoke-virtual {v0}, Ljava/io/File;->canWrite()Z
move-result v0
if-eqz v0, :cond_0
.line 2
iget-object v0, p0, Lcom/loopj/android/http/k;->t:Ljava/io/File;
invoke-virtual {v0}, Ljava/io/File;->length()J
move-result-wide v0
iput-wide v0, p0, Lcom/loopj/android/http/w;->y:J
.line 3
:cond_0
iget-wide v0, p0, Lcom/loopj/android/http/w;->y:J
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-lez v0, :cond_1
const/4 v0, 0x1
.line 4
iput-boolean v0, p0, Lcom/loopj/android/http/w;->z:Z
const-string v0, "bytes="
.line 5
invoke-static {v0}, Landroid/support/v4/media/d;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
iget-wide v1, p0, Lcom/loopj/android/http/w;->y:J
const-string v3, "-"
invoke-static {v0, v1, v2, v3}, Landroid/support/v4/media/session/a;->a(Ljava/lang/StringBuilder;JLjava/lang/String;)Ljava/lang/String;
move-result-object v0
const-string v1, "Range"
invoke-interface {p1, v1, v0}, Ldf/p;->setHeader(Ljava/lang/String;Ljava/lang/String;)V
:cond_1
return-void
.end method
.method public f(Ldf/t;)V
.locals 5
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/Thread;->isInterrupted()Z
move-result v0
if-nez v0, :cond_3
.line 2
invoke-interface {p1}, Ldf/t;->getStatusLine()Ldf/b0;
move-result-object v0
.line 3
invoke-interface {v0}, Ldf/b0;->getStatusCode()I
move-result v1
const/16 v2, 0x1a0
const/4 v3, 0x0
if-ne v1, v2, :cond_0
.line 4
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Thread;->isInterrupted()Z
move-result v1
if-nez v1, :cond_3
.line 5
invoke-interface {v0}, Ldf/b0;->getStatusCode()I
move-result v0
invoke-interface {p1}, Ldf/p;->getAllHeaders()[Ldf/d;
move-result-object p1
invoke-virtual {p0, v0, p1, v3}, Lcom/loopj/android/http/c;->c(I[Ldf/d;[B)V
goto :goto_1
.line 6
:cond_0
invoke-interface {v0}, Ldf/b0;->getStatusCode()I
move-result v1
const/16 v2, 0x12c
if-lt v1, v2, :cond_1
.line 7
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Thread;->isInterrupted()Z
move-result v1
if-nez v1, :cond_3
.line 8
invoke-interface {v0}, Ldf/b0;->getStatusCode()I
move-result v1
invoke-interface {p1}, Ldf/p;->getAllHeaders()[Ldf/d;
move-result-object p1
new-instance v2, Lcz/msebera/android/httpclient/client/HttpResponseException;
invoke-interface {v0}, Ldf/b0;->getStatusCode()I
move-result v4
invoke-interface {v0}, Ldf/b0;->getReasonPhrase()Ljava/lang/String;
move-result-object v0
invoke-direct {v2, v4, v0}, Lcz/msebera/android/httpclient/client/HttpResponseException;-><init>(ILjava/lang/String;)V
invoke-virtual {p0, v1, p1, v3, v2}, Lcom/loopj/android/http/c;->p(I[Ldf/d;[BLjava/lang/Throwable;)V
goto :goto_1
.line 9
:cond_1
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Thread;->isInterrupted()Z
move-result v1
if-nez v1, :cond_3
const-string v1, "Content-Range"
.line 10
invoke-interface {p1, v1}, Ldf/p;->getFirstHeader(Ljava/lang/String;)Ldf/d;
move-result-object v1
if-nez v1, :cond_2
const/4 v1, 0x0
.line 11
iput-boolean v1, p0, Lcom/loopj/android/http/w;->z:Z
const-wide/16 v1, 0x0
.line 12
iput-wide v1, p0, Lcom/loopj/android/http/w;->y:J
goto :goto_0
.line 13
:cond_2
sget-object v2, Lcom/loopj/android/http/a;->v:Lcom/loopj/android/http/r;
const-string v3, "Content-Range: "
invoke-static {v3}, Landroid/support/v4/media/d;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-interface {v1}, Ldf/d;->getValue()Ljava/lang/String;
move-result-object v1
invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
const-string v3, "RangeFileAsyncHttpRH"
invoke-interface {v2, v3, v1}, Lcom/loopj/android/http/r;->c(Ljava/lang/String;Ljava/lang/String;)V
.line 14
:goto_0
invoke-interface {v0}, Ldf/b0;->getStatusCode()I
move-result v0
invoke-interface {p1}, Ldf/p;->getAllHeaders()[Ldf/d;
move-result-object v1
invoke-interface {p1}, Ldf/t;->getEntity()Ldf/l;
move-result-object p1
invoke-virtual {p0, p1}, Lcom/loopj/android/http/w;->u(Ldf/l;)[B
move-result-object p1
invoke-virtual {p0, v0, v1, p1}, Lcom/loopj/android/http/c;->c(I[Ldf/d;[B)V
:cond_3
:goto_1
return-void
.end method
.method public u(Ldf/l;)[B
.locals 9
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
if-eqz p1, :cond_1
.line 1
invoke-interface {p1}, Ldf/l;->getContent()Ljava/io/InputStream;
move-result-object v0
.line 2
invoke-interface {p1}, Ldf/l;->getContentLength()J
move-result-wide v1
iget-wide v3, p0, Lcom/loopj/android/http/w;->y:J
add-long/2addr v1, v3
.line 3
new-instance p1, Ljava/io/FileOutputStream;
invoke-virtual {p0}, Lcom/loopj/android/http/k;->K()Ljava/io/File;
move-result-object v3
iget-boolean v4, p0, Lcom/loopj/android/http/w;->z:Z
invoke-direct {p1, v3, v4}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;Z)V
if-eqz v0, :cond_1
const/16 v3, 0x1000
:try_start_0
new-array v3, v3, [B
.line 4
:goto_0
iget-wide v4, p0, Lcom/loopj/android/http/w;->y:J
cmp-long v4, v4, v1
if-gez v4, :cond_0
invoke-virtual {v0, v3}, Ljava/io/InputStream;->read([B)I
move-result v4
const/4 v5, -0x1
if-eq v4, v5, :cond_0
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object v5
invoke-virtual {v5}, Ljava/lang/Thread;->isInterrupted()Z
move-result v5
if-nez v5, :cond_0
.line 5
iget-wide v5, p0, Lcom/loopj/android/http/w;->y:J
int-to-long v7, v4
add-long/2addr v5, v7
iput-wide v5, p0, Lcom/loopj/android/http/w;->y:J
const/4 v5, 0x0
.line 6
invoke-virtual {p1, v3, v5, v4}, Ljava/io/FileOutputStream;->write([BII)V
.line 7
iget-wide v4, p0, Lcom/loopj/android/http/w;->y:J
invoke-virtual {p0, v4, v5, v1, v2}, Lcom/loopj/android/http/c;->g(JJ)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
.line 8
:cond_0
invoke-virtual {v0}, Ljava/io/InputStream;->close()V
.line 9
invoke-virtual {p1}, Ljava/io/FileOutputStream;->flush()V
.line 10
invoke-virtual {p1}, Ljava/io/FileOutputStream;->close()V
goto :goto_1
:catchall_0
move-exception v1
.line 11
invoke-virtual {v0}, Ljava/io/InputStream;->close()V
.line 12
invoke-virtual {p1}, Ljava/io/FileOutputStream;->flush()V
.line 13
invoke-virtual {p1}, Ljava/io/FileOutputStream;->close()V
throw v1
:cond_1
:goto_1
const/4 p1, 0x0
return-object p1
.end method