SimpleMultipartEntity$FilePart.smali
.class Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;
.super Ljava/lang/Object;
.source "SimpleMultipartEntity.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/loopj/android/http/SimpleMultipartEntity;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x2
name = "FilePart"
.end annotation
# instance fields
.field public file:Ljava/io/File;
.field public header:[B
.field final synthetic this$0:Lcom/loopj/android/http/SimpleMultipartEntity;
# direct methods
.method public constructor <init>(Lcom/loopj/android/http/SimpleMultipartEntity;Ljava/lang/String;Ljava/io/File;Ljava/lang/String;)V
.registers 5
.line 170
iput-object p1, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->this$0:Lcom/loopj/android/http/SimpleMultipartEntity;
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 171
invoke-virtual {p3}, Ljava/io/File;->getName()Ljava/lang/String;
move-result-object p1
invoke-direct {p0, p2, p1, p4}, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->createHeader(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)[B
move-result-object p1
iput-object p1, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->header:[B
.line 172
iput-object p3, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->file:Ljava/io/File;
return-void
.end method
.method private createHeader(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)[B
.registers 6
.line 176
new-instance v0, Ljava/io/ByteArrayOutputStream;
invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V
.line 178
:try_start_5
iget-object v1, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->this$0:Lcom/loopj/android/http/SimpleMultipartEntity;
# getter for: Lcom/loopj/android/http/SimpleMultipartEntity;->boundaryLine:[B
invoke-static {v1}, Lcom/loopj/android/http/SimpleMultipartEntity;->access$000(Lcom/loopj/android/http/SimpleMultipartEntity;)[B
move-result-object v1
invoke-virtual {v0, v1}, Ljava/io/ByteArrayOutputStream;->write([B)V
.line 181
iget-object v1, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->this$0:Lcom/loopj/android/http/SimpleMultipartEntity;
# invokes: Lcom/loopj/android/http/SimpleMultipartEntity;->createContentDisposition(Ljava/lang/String;Ljava/lang/String;)[B
invoke-static {v1, p1, p2}, Lcom/loopj/android/http/SimpleMultipartEntity;->access$100(Lcom/loopj/android/http/SimpleMultipartEntity;Ljava/lang/String;Ljava/lang/String;)[B
move-result-object p1
invoke-virtual {v0, p1}, Ljava/io/ByteArrayOutputStream;->write([B)V
.line 182
iget-object p1, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->this$0:Lcom/loopj/android/http/SimpleMultipartEntity;
# invokes: Lcom/loopj/android/http/SimpleMultipartEntity;->createContentType(Ljava/lang/String;)[B
invoke-static {p1, p3}, Lcom/loopj/android/http/SimpleMultipartEntity;->access$200(Lcom/loopj/android/http/SimpleMultipartEntity;Ljava/lang/String;)[B
move-result-object p1
invoke-virtual {v0, p1}, Ljava/io/ByteArrayOutputStream;->write([B)V
.line 183
# getter for: Lcom/loopj/android/http/SimpleMultipartEntity;->TRANSFER_ENCODING_BINARY:[B
invoke-static {}, Lcom/loopj/android/http/SimpleMultipartEntity;->access$300()[B
move-result-object p1
invoke-virtual {v0, p1}, Ljava/io/ByteArrayOutputStream;->write([B)V
.line 184
# getter for: Lcom/loopj/android/http/SimpleMultipartEntity;->CR_LF:[B
invoke-static {}, Lcom/loopj/android/http/SimpleMultipartEntity;->access$400()[B
move-result-object p1
invoke-virtual {v0, p1}, Ljava/io/ByteArrayOutputStream;->write([B)V
:try_end_2e
.catch Ljava/io/IOException; {:try_start_5 .. :try_end_2e} :catch_2f
goto :goto_37
:catch_2f
move-exception p1
const-string p2, "SimpleMultipartEntity"
const-string p3, "createHeader ByteArrayOutputStream exception"
.line 187
invoke-static {p2, p3, p1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
.line 189
:goto_37
invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
move-result-object p1
return-object p1
.end method
# virtual methods
.method public getTotalLength()J
.registers 5
.line 193
iget-object v0, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->file:Ljava/io/File;
invoke-virtual {v0}, Ljava/io/File;->length()J
move-result-wide v0
.line 194
iget-object v2, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->header:[B
array-length v2, v2
int-to-long v2, v2
add-long/2addr v2, v0
return-wide v2
.end method
.method public writeTo(Ljava/io/OutputStream;)V
.registers 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 198
iget-object v0, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->header:[B
invoke-virtual {p1, v0}, Ljava/io/OutputStream;->write([B)V
.line 199
iget-object v0, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->this$0:Lcom/loopj/android/http/SimpleMultipartEntity;
iget-object v1, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->header:[B
array-length v1, v1
# invokes: Lcom/loopj/android/http/SimpleMultipartEntity;->updateProgress(I)V
invoke-static {v0, v1}, Lcom/loopj/android/http/SimpleMultipartEntity;->access$500(Lcom/loopj/android/http/SimpleMultipartEntity;I)V
.line 201
new-instance v0, Ljava/io/FileInputStream;
iget-object v1, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->file:Ljava/io/File;
invoke-direct {v0, v1}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
const/16 v1, 0x1000
new-array v1, v1, [B
.line 204
:goto_18
invoke-virtual {v0, v1}, Ljava/io/FileInputStream;->read([B)I
move-result v2
const/4 v3, -0x1
if-eq v2, v3, :cond_29
const/4 v3, 0x0
.line 205
invoke-virtual {p1, v1, v3, v2}, Ljava/io/OutputStream;->write([BII)V
.line 206
iget-object v3, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->this$0:Lcom/loopj/android/http/SimpleMultipartEntity;
# invokes: Lcom/loopj/android/http/SimpleMultipartEntity;->updateProgress(I)V
invoke-static {v3, v2}, Lcom/loopj/android/http/SimpleMultipartEntity;->access$500(Lcom/loopj/android/http/SimpleMultipartEntity;I)V
goto :goto_18
.line 208
:cond_29
# getter for: Lcom/loopj/android/http/SimpleMultipartEntity;->CR_LF:[B
invoke-static {}, Lcom/loopj/android/http/SimpleMultipartEntity;->access$400()[B
move-result-object v1
invoke-virtual {p1, v1}, Ljava/io/OutputStream;->write([B)V
.line 209
iget-object v1, p0, Lcom/loopj/android/http/SimpleMultipartEntity$FilePart;->this$0:Lcom/loopj/android/http/SimpleMultipartEntity;
# getter for: Lcom/loopj/android/http/SimpleMultipartEntity;->CR_LF:[B
invoke-static {}, Lcom/loopj/android/http/SimpleMultipartEntity;->access$400()[B
move-result-object v2
array-length v2, v2
# invokes: Lcom/loopj/android/http/SimpleMultipartEntity;->updateProgress(I)V
invoke-static {v1, v2}, Lcom/loopj/android/http/SimpleMultipartEntity;->access$500(Lcom/loopj/android/http/SimpleMultipartEntity;I)V
.line 210
invoke-virtual {p1}, Ljava/io/OutputStream;->flush()V
.line 212
:try_start_3d
invoke-virtual {v0}, Ljava/io/FileInputStream;->close()V
:try_end_40
.catch Ljava/io/IOException; {:try_start_3d .. :try_end_40} :catch_41
goto :goto_49
:catch_41
move-exception p1
const-string v0, "SimpleMultipartEntity"
const-string v1, "Cannot close input stream"
.line 215
invoke-static {v0, v1, p1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:goto_49
return-void
.end method