173 lines
3.5 KiB
Smali
173 lines
3.5 KiB
Smali
.class public Lorg/apache/http/entity/FileEntity;
|
|
.super Lorg/apache/http/entity/AbstractHttpEntity;
|
|
.source "FileEntity.java"
|
|
|
|
# interfaces
|
|
.implements Ljava/lang/Cloneable;
|
|
|
|
|
|
# instance fields
|
|
.field public final file:Ljava/io/File;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Ljava/io/File;Ljava/lang/String;)V
|
|
.locals 0
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lorg/apache/http/entity/AbstractHttpEntity;-><init>()V
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
.line 2
|
|
iput-object p1, p0, Lorg/apache/http/entity/FileEntity;->file:Ljava/io/File;
|
|
|
|
.line 3
|
|
invoke-virtual {p0, p2}, Lorg/apache/http/entity/AbstractHttpEntity;->setContentType(Ljava/lang/String;)V
|
|
|
|
return-void
|
|
|
|
.line 4
|
|
:cond_0
|
|
new-instance p1, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string p2, "File 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/FileInputStream;
|
|
|
|
iget-object v1, p0, Lorg/apache/http/entity/FileEntity;->file:Ljava/io/File;
|
|
|
|
invoke-direct {v0, v1}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public getContentLength()J
|
|
.locals 2
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lorg/apache/http/entity/FileEntity;->file:Ljava/io/File;
|
|
|
|
invoke-virtual {v0}, Ljava/io/File;->length()J
|
|
|
|
move-result-wide 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 4
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
.line 1
|
|
new-instance v0, Ljava/io/FileInputStream;
|
|
|
|
iget-object v1, p0, Lorg/apache/http/entity/FileEntity;->file:Ljava/io/File;
|
|
|
|
invoke-direct {v0, v1}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
|
|
|
|
const/16 v1, 0x1000
|
|
|
|
:try_start_0
|
|
new-array v1, v1, [B
|
|
|
|
.line 2
|
|
:goto_0
|
|
invoke-virtual {v0, v1}, Ljava/io/InputStream;->read([B)I
|
|
|
|
move-result v2
|
|
|
|
const/4 v3, -0x1
|
|
|
|
if-eq v2, v3, :cond_0
|
|
|
|
const/4 v3, 0x0
|
|
|
|
.line 3
|
|
invoke-virtual {p1, v1, v3, v2}, Ljava/io/OutputStream;->write([BII)V
|
|
|
|
goto :goto_0
|
|
|
|
.line 4
|
|
:cond_0
|
|
invoke-virtual {p1}, Ljava/io/OutputStream;->flush()V
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
.line 5
|
|
invoke-virtual {v0}, Ljava/io/InputStream;->close()V
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
invoke-virtual {v0}, Ljava/io/InputStream;->close()V
|
|
|
|
throw p1
|
|
|
|
.line 6
|
|
:cond_1
|
|
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
|