BinaryHttpResponseHandler.smali
.class public Lcom/loopj/android/http/BinaryHttpResponseHandler;
.super Lcom/loopj/android/http/AsyncHttpResponseHandler;
.source "BinaryHttpResponseHandler.java"
# instance fields
.field private mAllowedContentTypes:[Ljava/lang/String;
# direct methods
.method public constructor <init>()V
.registers 4
.line 73
invoke-direct {p0}, Lcom/loopj/android/http/AsyncHttpResponseHandler;-><init>()V
const/4 v0, 0x2
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "image/jpeg"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "image/png"
aput-object v2, v0, v1
.line 54
iput-object v0, p0, Lcom/loopj/android/http/BinaryHttpResponseHandler;->mAllowedContentTypes:[Ljava/lang/String;
return-void
.end method
.method public constructor <init>([Ljava/lang/String;)V
.registers 2
.line 83
invoke-direct {p0}, Lcom/loopj/android/http/BinaryHttpResponseHandler;-><init>()V
.line 84
iput-object p1, p0, Lcom/loopj/android/http/BinaryHttpResponseHandler;->mAllowedContentTypes:[Ljava/lang/String;
return-void
.end method
# virtual methods
.method public getAllowedContentTypes()[Ljava/lang/String;
.registers 2
.line 66
iget-object v0, p0, Lcom/loopj/android/http/BinaryHttpResponseHandler;->mAllowedContentTypes:[Ljava/lang/String;
return-object v0
.end method
.method public onFailure(I[Lorg/apache/http/Header;[BLjava/lang/Throwable;)V
.registers 5
const/4 p2, 0x0
.line 134
invoke-virtual {p0, p1, p4, p2}, Lcom/loopj/android/http/BinaryHttpResponseHandler;->onFailure(ILjava/lang/Throwable;Ljava/lang/String;)V
return-void
.end method
.method public onSuccess(I[B)V
.registers 3
.line 107
invoke-virtual {p0, p2}, Lcom/loopj/android/http/BinaryHttpResponseHandler;->onSuccess([B)V
return-void
.end method
.method public onSuccess(I[Lorg/apache/http/Header;[B)V
.registers 4
.line 120
invoke-virtual {p0, p1, p3}, Lcom/loopj/android/http/BinaryHttpResponseHandler;->onSuccess(I[B)V
return-void
.end method
.method public onSuccess([B)V
.registers 2
return-void
.end method
.method public final sendResponseMessage(Lorg/apache/http/HttpResponse;)V
.registers 14
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 144
invoke-interface {p1}, Lorg/apache/http/HttpResponse;->getStatusLine()Lorg/apache/http/StatusLine;
move-result-object v0
const-string v1, "Content-Type"
.line 145
invoke-interface {p1, v1}, Lorg/apache/http/HttpResponse;->getHeaders(Ljava/lang/String;)[Lorg/apache/http/Header;
move-result-object v1
.line 146
array-length v2, v1
const/4 v3, 0x0
const/4 v4, 0x1
if-eq v2, v4, :cond_26
.line 148
invoke-interface {v0}, Lorg/apache/http/StatusLine;->getStatusCode()I
move-result v1
invoke-interface {p1}, Lorg/apache/http/HttpResponse;->getAllHeaders()[Lorg/apache/http/Header;
move-result-object p1
new-instance v2, Lorg/apache/http/client/HttpResponseException;
invoke-interface {v0}, Lorg/apache/http/StatusLine;->getStatusCode()I
move-result v0
const-string v4, "None, or more than one, Content-Type Header found!"
invoke-direct {v2, v0, v4}, Lorg/apache/http/client/HttpResponseException;-><init>(ILjava/lang/String;)V
invoke-virtual {p0, v1, p1, v3, v2}, Lcom/loopj/android/http/BinaryHttpResponseHandler;->sendFailureMessage(I[Lorg/apache/http/Header;[BLjava/lang/Throwable;)V
return-void
:cond_26
const/4 v2, 0x0
.line 151
aget-object v1, v1, v2
.line 153
invoke-virtual {p0}, Lcom/loopj/android/http/BinaryHttpResponseHandler;->getAllowedContentTypes()[Ljava/lang/String;
move-result-object v5
array-length v6, v5
const/4 v7, 0x0
:goto_2f
if-ge v2, v6, :cond_59
aget-object v8, v5, v2
.line 155
:try_start_33
invoke-interface {v1}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;
move-result-object v9
invoke-static {v8, v9}, Ljava/util/regex/Pattern;->matches(Ljava/lang/String;Ljava/lang/CharSequence;)Z
move-result v8
:try_end_3b
.catch Ljava/util/regex/PatternSyntaxException; {:try_start_33 .. :try_end_3b} :catch_3f
if-eqz v8, :cond_56
const/4 v7, 0x1
goto :goto_56
:catch_3f
move-exception v9
.line 159
new-instance v10, Ljava/lang/StringBuilder;
invoke-direct {v10}, Ljava/lang/StringBuilder;-><init>()V
const-string v11, "Given pattern is not valid: "
invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v10, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v8
const-string v10, "BinaryHttpResponseHandler"
invoke-static {v10, v8, v9}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:cond_56
:goto_56
add-int/lit8 v2, v2, 0x1
goto :goto_2f
:cond_59
if-nez v7, :cond_72
.line 164
invoke-interface {v0}, Lorg/apache/http/StatusLine;->getStatusCode()I
move-result v1
invoke-interface {p1}, Lorg/apache/http/HttpResponse;->getAllHeaders()[Lorg/apache/http/Header;
move-result-object p1
new-instance v2, Lorg/apache/http/client/HttpResponseException;
invoke-interface {v0}, Lorg/apache/http/StatusLine;->getStatusCode()I
move-result v0
const-string v4, "Content-Type not allowed!"
invoke-direct {v2, v0, v4}, Lorg/apache/http/client/HttpResponseException;-><init>(ILjava/lang/String;)V
invoke-virtual {p0, v1, p1, v3, v2}, Lcom/loopj/android/http/BinaryHttpResponseHandler;->sendFailureMessage(I[Lorg/apache/http/Header;[BLjava/lang/Throwable;)V
return-void
.line 167
:cond_72
invoke-super {p0, p1}, Lcom/loopj/android/http/AsyncHttpResponseHandler;->sendResponseMessage(Lorg/apache/http/HttpResponse;)V
return-void
.end method