180 lines
4.0 KiB
Smali
180 lines
4.0 KiB
Smali
.class public Lorg/apache/http/entity/StringEntity;
|
|
.super Lorg/apache/http/entity/AbstractHttpEntity;
|
|
.source "StringEntity.java"
|
|
|
|
# interfaces
|
|
.implements Ljava/lang/Cloneable;
|
|
|
|
|
|
# instance fields
|
|
.field public final content:[B
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Ljava/lang/String;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/UnsupportedEncodingException;
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 5
|
|
invoke-direct {p0, p1, v0}, Lorg/apache/http/entity/StringEntity;-><init>(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Ljava/lang/String;Ljava/lang/String;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/UnsupportedEncodingException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lorg/apache/http/entity/AbstractHttpEntity;-><init>()V
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
if-nez p2, :cond_0
|
|
|
|
const-string p2, "ISO-8859-1"
|
|
|
|
.line 2
|
|
:cond_0
|
|
invoke-virtual {p1, p2}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B
|
|
|
|
move-result-object p1
|
|
|
|
iput-object p1, p0, Lorg/apache/http/entity/StringEntity;->content:[B
|
|
|
|
.line 3
|
|
new-instance p1, Ljava/lang/StringBuffer;
|
|
|
|
invoke-direct {p1}, Ljava/lang/StringBuffer;-><init>()V
|
|
|
|
const-string v0, "text/plain; charset="
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p0, p1}, Lorg/apache/http/entity/AbstractHttpEntity;->setContentType(Ljava/lang/String;)V
|
|
|
|
return-void
|
|
|
|
.line 4
|
|
:cond_1
|
|
new-instance p1, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string p2, "Source string may not be null"
|
|
|
|
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public clone()Ljava/lang/Object;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/lang/CloneNotSupportedException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-super {p0}, Ljava/lang/Object;->clone()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public getContent()Ljava/io/InputStream;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
new-instance v0, Ljava/io/ByteArrayInputStream;
|
|
|
|
iget-object v1, p0, Lorg/apache/http/entity/StringEntity;->content:[B
|
|
|
|
invoke-direct {v0, v1}, Ljava/io/ByteArrayInputStream;-><init>([B)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public getContentLength()J
|
|
.locals 2
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lorg/apache/http/entity/StringEntity;->content:[B
|
|
|
|
array-length v0, v0
|
|
|
|
int-to-long v0, v0
|
|
|
|
return-wide v0
|
|
.end method
|
|
|
|
.method public isRepeatable()Z
|
|
.locals 1
|
|
|
|
const/4 v0, 0x1
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public isStreaming()Z
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public writeTo(Ljava/io/OutputStream;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lorg/apache/http/entity/StringEntity;->content:[B
|
|
|
|
invoke-virtual {p1, v0}, Ljava/io/OutputStream;->write([B)V
|
|
|
|
.line 2
|
|
invoke-virtual {p1}, Ljava/io/OutputStream;->flush()V
|
|
|
|
return-void
|
|
|
|
.line 3
|
|
:cond_0
|
|
new-instance p1, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string v0, "Output stream may not be null"
|
|
|
|
invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
.end method
|