189 lines
5.3 KiB
Smali
189 lines
5.3 KiB
Smali
.class public Lorg/apache/http/impl/entity/EntityDeserializer;
|
|
.super Ljava/lang/Object;
|
|
.source "EntityDeserializer.java"
|
|
|
|
|
|
# instance fields
|
|
.field private final lenStrategy:Lorg/apache/http/entity/ContentLengthStrategy;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Lorg/apache/http/entity/ContentLengthStrategy;)V
|
|
.locals 1
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
.line 2
|
|
iput-object p1, p0, Lorg/apache/http/impl/entity/EntityDeserializer;->lenStrategy:Lorg/apache/http/entity/ContentLengthStrategy;
|
|
|
|
return-void
|
|
|
|
.line 3
|
|
:cond_0
|
|
new-instance p1, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string v0, "Content length strategy may not be null"
|
|
|
|
invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public deserialize(Lorg/apache/http/io/SessionInputBuffer;Lorg/apache/http/HttpMessage;)Lorg/apache/http/HttpEntity;
|
|
.locals 0
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Lorg/apache/http/HttpException;,
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
if-eqz p2, :cond_0
|
|
|
|
.line 1
|
|
invoke-virtual {p0, p1, p2}, Lorg/apache/http/impl/entity/EntityDeserializer;->doDeserialize(Lorg/apache/http/io/SessionInputBuffer;Lorg/apache/http/HttpMessage;)Lorg/apache/http/entity/BasicHttpEntity;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
|
|
.line 2
|
|
:cond_0
|
|
new-instance p1, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string p2, "HTTP message may not be null"
|
|
|
|
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
|
|
.line 3
|
|
:cond_1
|
|
new-instance p1, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string p2, "Session input buffer may not be null"
|
|
|
|
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public doDeserialize(Lorg/apache/http/io/SessionInputBuffer;Lorg/apache/http/HttpMessage;)Lorg/apache/http/entity/BasicHttpEntity;
|
|
.locals 7
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Lorg/apache/http/HttpException;,
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
new-instance v0, Lorg/apache/http/entity/BasicHttpEntity;
|
|
|
|
invoke-direct {v0}, Lorg/apache/http/entity/BasicHttpEntity;-><init>()V
|
|
|
|
.line 2
|
|
iget-object v1, p0, Lorg/apache/http/impl/entity/EntityDeserializer;->lenStrategy:Lorg/apache/http/entity/ContentLengthStrategy;
|
|
|
|
invoke-interface {v1, p2}, Lorg/apache/http/entity/ContentLengthStrategy;->determineLength(Lorg/apache/http/HttpMessage;)J
|
|
|
|
move-result-wide v1
|
|
|
|
const-wide/16 v3, -0x2
|
|
|
|
cmp-long v3, v1, v3
|
|
|
|
const-wide/16 v4, -0x1
|
|
|
|
if-nez v3, :cond_0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
.line 3
|
|
invoke-virtual {v0, v1}, Lorg/apache/http/entity/AbstractHttpEntity;->setChunked(Z)V
|
|
|
|
.line 4
|
|
invoke-virtual {v0, v4, v5}, Lorg/apache/http/entity/BasicHttpEntity;->setContentLength(J)V
|
|
|
|
.line 5
|
|
new-instance v1, Lorg/apache/http/impl/io/ChunkedInputStream;
|
|
|
|
invoke-direct {v1, p1}, Lorg/apache/http/impl/io/ChunkedInputStream;-><init>(Lorg/apache/http/io/SessionInputBuffer;)V
|
|
|
|
invoke-virtual {v0, v1}, Lorg/apache/http/entity/BasicHttpEntity;->setContent(Ljava/io/InputStream;)V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
cmp-long v3, v1, v4
|
|
|
|
const/4 v6, 0x0
|
|
|
|
if-nez v3, :cond_1
|
|
|
|
.line 6
|
|
invoke-virtual {v0, v6}, Lorg/apache/http/entity/AbstractHttpEntity;->setChunked(Z)V
|
|
|
|
.line 7
|
|
invoke-virtual {v0, v4, v5}, Lorg/apache/http/entity/BasicHttpEntity;->setContentLength(J)V
|
|
|
|
.line 8
|
|
new-instance v1, Lorg/apache/http/impl/io/IdentityInputStream;
|
|
|
|
invoke-direct {v1, p1}, Lorg/apache/http/impl/io/IdentityInputStream;-><init>(Lorg/apache/http/io/SessionInputBuffer;)V
|
|
|
|
invoke-virtual {v0, v1}, Lorg/apache/http/entity/BasicHttpEntity;->setContent(Ljava/io/InputStream;)V
|
|
|
|
goto :goto_0
|
|
|
|
.line 9
|
|
:cond_1
|
|
invoke-virtual {v0, v6}, Lorg/apache/http/entity/AbstractHttpEntity;->setChunked(Z)V
|
|
|
|
.line 10
|
|
invoke-virtual {v0, v1, v2}, Lorg/apache/http/entity/BasicHttpEntity;->setContentLength(J)V
|
|
|
|
.line 11
|
|
new-instance v3, Lorg/apache/http/impl/io/ContentLengthInputStream;
|
|
|
|
invoke-direct {v3, p1, v1, v2}, Lorg/apache/http/impl/io/ContentLengthInputStream;-><init>(Lorg/apache/http/io/SessionInputBuffer;J)V
|
|
|
|
invoke-virtual {v0, v3}, Lorg/apache/http/entity/BasicHttpEntity;->setContent(Ljava/io/InputStream;)V
|
|
|
|
:goto_0
|
|
const-string p1, "Content-Type"
|
|
|
|
.line 12
|
|
invoke-interface {p2, p1}, Lorg/apache/http/HttpMessage;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_2
|
|
|
|
.line 13
|
|
invoke-virtual {v0, p1}, Lorg/apache/http/entity/AbstractHttpEntity;->setContentType(Lorg/apache/http/Header;)V
|
|
|
|
:cond_2
|
|
const-string p1, "Content-Encoding"
|
|
|
|
.line 14
|
|
invoke-interface {p2, p1}, Lorg/apache/http/HttpMessage;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
.line 15
|
|
invoke-virtual {v0, p1}, Lorg/apache/http/entity/AbstractHttpEntity;->setContentEncoding(Lorg/apache/http/Header;)V
|
|
|
|
:cond_3
|
|
return-object v0
|
|
.end method
|