2473 lines
57 KiB
Smali
2473 lines
57 KiB
Smali
.class public final Lcom/blankj/utilcode/util/FileIOUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "FileIOUtils.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field private static sBufferSize:I = 0x80000
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 0
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>()V
|
|
.locals 2
|
|
|
|
.line 40
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
.line 41
|
|
new-instance v0, Ljava/lang/UnsupportedOperationException;
|
|
|
|
const-string v1, "u can\'t instantiate me..."
|
|
|
|
invoke-direct {v0, v1}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static readFile2BytesByChannel(Ljava/io/File;)[B
|
|
.locals 4
|
|
|
|
.line 867
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->isFileExists(Ljava/io/File;)Z
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
return-object v1
|
|
|
|
.line 870
|
|
:cond_0
|
|
:try_start_0
|
|
new-instance v0, Ljava/io/RandomAccessFile;
|
|
|
|
const-string v2, "r"
|
|
|
|
invoke-direct {v0, p0, v2}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel;
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_3
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
if-nez p0, :cond_2
|
|
|
|
:try_start_1
|
|
const-string v0, "FileIOUtils"
|
|
|
|
const-string v2, "fc is null."
|
|
|
|
.line 872
|
|
invoke-static {v0, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
const/4 v0, 0x0
|
|
|
|
new-array v0, v0, [B
|
|
:try_end_1
|
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_2
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_1
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
.line 886
|
|
:try_start_2
|
|
invoke-virtual {p0}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_2
|
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 889
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_1
|
|
:goto_0
|
|
return-object v0
|
|
|
|
.line 875
|
|
:cond_2
|
|
:try_start_3
|
|
invoke-virtual {p0}, Ljava/nio/channels/FileChannel;->size()J
|
|
|
|
move-result-wide v2
|
|
|
|
long-to-int v0, v2
|
|
|
|
invoke-static {v0}, Ljava/nio/ByteBuffer;->allocate(I)Ljava/nio/ByteBuffer;
|
|
|
|
move-result-object v0
|
|
|
|
.line 877
|
|
:cond_3
|
|
invoke-virtual {p0, v0}, Ljava/nio/channels/FileChannel;->read(Ljava/nio/ByteBuffer;)I
|
|
|
|
move-result v2
|
|
|
|
if-gtz v2, :cond_3
|
|
|
|
.line 879
|
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->array()[B
|
|
|
|
move-result-object v0
|
|
:try_end_3
|
|
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_2
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_1
|
|
|
|
if-eqz p0, :cond_4
|
|
|
|
.line 886
|
|
:try_start_4
|
|
invoke-virtual {p0}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_4
|
|
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_1
|
|
|
|
goto :goto_1
|
|
|
|
:catch_1
|
|
move-exception p0
|
|
|
|
.line 889
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_4
|
|
:goto_1
|
|
return-object v0
|
|
|
|
:catch_2
|
|
move-exception v0
|
|
|
|
goto :goto_2
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
goto :goto_4
|
|
|
|
:catch_3
|
|
move-exception v0
|
|
|
|
move-object p0, v1
|
|
|
|
.line 881
|
|
:goto_2
|
|
:try_start_5
|
|
invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_5
|
|
.catchall {:try_start_5 .. :try_end_5} :catchall_1
|
|
|
|
if-eqz p0, :cond_5
|
|
|
|
.line 886
|
|
:try_start_6
|
|
invoke-virtual {p0}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_6
|
|
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_4
|
|
|
|
goto :goto_3
|
|
|
|
:catch_4
|
|
move-exception p0
|
|
|
|
.line 889
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_5
|
|
:goto_3
|
|
return-object v1
|
|
|
|
:catchall_1
|
|
move-exception v0
|
|
|
|
move-object v1, p0
|
|
|
|
:goto_4
|
|
if-eqz v1, :cond_6
|
|
|
|
.line 886
|
|
:try_start_7
|
|
invoke-virtual {v1}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_7
|
|
.catch Ljava/io/IOException; {:try_start_7 .. :try_end_7} :catch_5
|
|
|
|
goto :goto_5
|
|
|
|
:catch_5
|
|
move-exception p0
|
|
|
|
.line 889
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
.line 891
|
|
:cond_6
|
|
:goto_5
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static readFile2BytesByChannel(Ljava/lang/String;)[B
|
|
.locals 0
|
|
|
|
.line 857
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2BytesByChannel(Ljava/io/File;)[B
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2BytesByMap(Ljava/io/File;)[B
|
|
.locals 9
|
|
|
|
.line 911
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->isFileExists(Ljava/io/File;)Z
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
return-object v1
|
|
|
|
.line 914
|
|
:cond_0
|
|
:try_start_0
|
|
new-instance v0, Ljava/io/RandomAccessFile;
|
|
|
|
const-string v2, "r"
|
|
|
|
invoke-direct {v0, p0, v2}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel;
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_3
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-nez p0, :cond_2
|
|
|
|
:try_start_1
|
|
const-string v2, "FileIOUtils"
|
|
|
|
const-string v3, "fc is null."
|
|
|
|
.line 916
|
|
invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
new-array v0, v0, [B
|
|
:try_end_1
|
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_2
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_1
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
.line 930
|
|
:try_start_2
|
|
invoke-virtual {p0}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_2
|
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 933
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_1
|
|
:goto_0
|
|
return-object v0
|
|
|
|
.line 919
|
|
:cond_2
|
|
:try_start_3
|
|
invoke-virtual {p0}, Ljava/nio/channels/FileChannel;->size()J
|
|
|
|
move-result-wide v2
|
|
|
|
long-to-int v2, v2
|
|
|
|
.line 920
|
|
sget-object v4, Ljava/nio/channels/FileChannel$MapMode;->READ_ONLY:Ljava/nio/channels/FileChannel$MapMode;
|
|
|
|
const-wide/16 v5, 0x0
|
|
|
|
int-to-long v7, v2
|
|
|
|
move-object v3, p0
|
|
|
|
invoke-virtual/range {v3 .. v8}, Ljava/nio/channels/FileChannel;->map(Ljava/nio/channels/FileChannel$MapMode;JJ)Ljava/nio/MappedByteBuffer;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3}, Ljava/nio/MappedByteBuffer;->load()Ljava/nio/MappedByteBuffer;
|
|
|
|
move-result-object v3
|
|
|
|
.line 921
|
|
new-array v4, v2, [B
|
|
|
|
.line 922
|
|
invoke-virtual {v3, v4, v0, v2}, Ljava/nio/MappedByteBuffer;->get([BII)Ljava/nio/ByteBuffer;
|
|
:try_end_3
|
|
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_2
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_1
|
|
|
|
if-eqz p0, :cond_3
|
|
|
|
.line 930
|
|
:try_start_4
|
|
invoke-virtual {p0}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_4
|
|
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_1
|
|
|
|
goto :goto_1
|
|
|
|
:catch_1
|
|
move-exception p0
|
|
|
|
.line 933
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_3
|
|
:goto_1
|
|
return-object v4
|
|
|
|
:catch_2
|
|
move-exception v0
|
|
|
|
goto :goto_2
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
goto :goto_4
|
|
|
|
:catch_3
|
|
move-exception v0
|
|
|
|
move-object p0, v1
|
|
|
|
.line 925
|
|
:goto_2
|
|
:try_start_5
|
|
invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_5
|
|
.catchall {:try_start_5 .. :try_end_5} :catchall_1
|
|
|
|
if-eqz p0, :cond_4
|
|
|
|
.line 930
|
|
:try_start_6
|
|
invoke-virtual {p0}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_6
|
|
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_4
|
|
|
|
goto :goto_3
|
|
|
|
:catch_4
|
|
move-exception p0
|
|
|
|
.line 933
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_4
|
|
:goto_3
|
|
return-object v1
|
|
|
|
:catchall_1
|
|
move-exception v0
|
|
|
|
move-object v1, p0
|
|
|
|
:goto_4
|
|
if-eqz v1, :cond_5
|
|
|
|
.line 930
|
|
:try_start_7
|
|
invoke-virtual {v1}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_7
|
|
.catch Ljava/io/IOException; {:try_start_7 .. :try_end_7} :catch_5
|
|
|
|
goto :goto_5
|
|
|
|
:catch_5
|
|
move-exception p0
|
|
|
|
.line 933
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
.line 935
|
|
:cond_5
|
|
:goto_5
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static readFile2BytesByMap(Ljava/lang/String;)[B
|
|
.locals 0
|
|
|
|
.line 901
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2BytesByMap(Ljava/io/File;)[B
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2BytesByStream(Ljava/io/File;)[B
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 776
|
|
invoke-static {p0, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2BytesByStream(Ljava/io/File;Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)[B
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2BytesByStream(Ljava/io/File;Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)[B
|
|
.locals 10
|
|
|
|
.line 804
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->isFileExists(Ljava/io/File;)Z
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
return-object v1
|
|
|
|
.line 807
|
|
:cond_0
|
|
:try_start_0
|
|
new-instance v0, Ljava/io/BufferedInputStream;
|
|
|
|
new-instance v2, Ljava/io/FileInputStream;
|
|
|
|
invoke-direct {v2, p0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
|
|
|
|
sget p0, Lcom/blankj/utilcode/util/FileIOUtils;->sBufferSize:I
|
|
|
|
invoke-direct {v0, v2, p0}, Ljava/io/BufferedInputStream;-><init>(Ljava/io/InputStream;I)V
|
|
:try_end_0
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_8
|
|
|
|
.line 809
|
|
:try_start_1
|
|
new-instance p0, Ljava/io/ByteArrayOutputStream;
|
|
|
|
invoke-direct {p0}, Ljava/io/ByteArrayOutputStream;-><init>()V
|
|
:try_end_1
|
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_3
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
.line 810
|
|
:try_start_2
|
|
sget v2, Lcom/blankj/utilcode/util/FileIOUtils;->sBufferSize:I
|
|
|
|
new-array v2, v2, [B
|
|
|
|
const/4 v3, -0x1
|
|
|
|
const/4 v4, 0x0
|
|
|
|
if-nez p1, :cond_1
|
|
|
|
.line 813
|
|
:goto_0
|
|
sget p1, Lcom/blankj/utilcode/util/FileIOUtils;->sBufferSize:I
|
|
|
|
invoke-virtual {v0, v2, v4, p1}, Ljava/io/InputStream;->read([BII)I
|
|
|
|
move-result p1
|
|
|
|
if-eq p1, v3, :cond_2
|
|
|
|
.line 814
|
|
invoke-virtual {p0, v2, v4, p1}, Ljava/io/ByteArrayOutputStream;->write([BII)V
|
|
|
|
goto :goto_0
|
|
|
|
.line 817
|
|
:cond_1
|
|
invoke-virtual {v0}, Ljava/io/InputStream;->available()I
|
|
|
|
move-result v5
|
|
|
|
int-to-double v5, v5
|
|
|
|
const-wide/16 v7, 0x0
|
|
|
|
.line 819
|
|
invoke-interface {p1, v7, v8}, Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;->onProgressUpdate(D)V
|
|
|
|
move v7, v4
|
|
|
|
.line 820
|
|
:goto_1
|
|
sget v8, Lcom/blankj/utilcode/util/FileIOUtils;->sBufferSize:I
|
|
|
|
invoke-virtual {v0, v2, v4, v8}, Ljava/io/InputStream;->read([BII)I
|
|
|
|
move-result v8
|
|
|
|
if-eq v8, v3, :cond_2
|
|
|
|
.line 821
|
|
invoke-virtual {p0, v2, v4, v8}, Ljava/io/ByteArrayOutputStream;->write([BII)V
|
|
|
|
add-int/2addr v7, v8
|
|
|
|
int-to-double v8, v7
|
|
|
|
div-double/2addr v8, v5
|
|
|
|
.line 823
|
|
invoke-interface {p1, v8, v9}, Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;->onProgressUpdate(D)V
|
|
|
|
goto :goto_1
|
|
|
|
.line 826
|
|
:cond_2
|
|
invoke-virtual {p0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
|
|
|
|
move-result-object p1
|
|
:try_end_2
|
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_2
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_1
|
|
|
|
.line 832
|
|
:try_start_3
|
|
invoke-virtual {v0}, Ljava/io/InputStream;->close()V
|
|
:try_end_3
|
|
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_0
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_3 .. :try_end_3} :catch_8
|
|
|
|
goto :goto_2
|
|
|
|
:catch_0
|
|
move-exception v0
|
|
|
|
.line 834
|
|
:try_start_4
|
|
invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_4
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_4 .. :try_end_4} :catch_8
|
|
|
|
.line 838
|
|
:goto_2
|
|
:try_start_5
|
|
invoke-virtual {p0}, Ljava/io/ByteArrayOutputStream;->close()V
|
|
:try_end_5
|
|
.catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_1
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_5 .. :try_end_5} :catch_8
|
|
|
|
goto :goto_3
|
|
|
|
:catch_1
|
|
move-exception p0
|
|
|
|
.line 841
|
|
:try_start_6
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_6
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_6 .. :try_end_6} :catch_8
|
|
|
|
:goto_3
|
|
return-object p1
|
|
|
|
:catch_2
|
|
move-exception p1
|
|
|
|
goto :goto_4
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
move-object p0, v1
|
|
|
|
goto :goto_7
|
|
|
|
:catch_3
|
|
move-exception p1
|
|
|
|
move-object p0, v1
|
|
|
|
.line 828
|
|
:goto_4
|
|
:try_start_7
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_7
|
|
.catchall {:try_start_7 .. :try_end_7} :catchall_1
|
|
|
|
.line 832
|
|
:try_start_8
|
|
invoke-virtual {v0}, Ljava/io/InputStream;->close()V
|
|
:try_end_8
|
|
.catch Ljava/io/IOException; {:try_start_8 .. :try_end_8} :catch_4
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_8 .. :try_end_8} :catch_8
|
|
|
|
goto :goto_5
|
|
|
|
:catch_4
|
|
move-exception p1
|
|
|
|
.line 834
|
|
:try_start_9
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_9
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_9 .. :try_end_9} :catch_8
|
|
|
|
:goto_5
|
|
if-eqz p0, :cond_3
|
|
|
|
.line 838
|
|
:try_start_a
|
|
invoke-virtual {p0}, Ljava/io/ByteArrayOutputStream;->close()V
|
|
:try_end_a
|
|
.catch Ljava/io/IOException; {:try_start_a .. :try_end_a} :catch_5
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_a .. :try_end_a} :catch_8
|
|
|
|
goto :goto_6
|
|
|
|
:catch_5
|
|
move-exception p0
|
|
|
|
.line 841
|
|
:try_start_b
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_b
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_b .. :try_end_b} :catch_8
|
|
|
|
:cond_3
|
|
:goto_6
|
|
return-object v1
|
|
|
|
:catchall_1
|
|
move-exception p1
|
|
|
|
.line 832
|
|
:goto_7
|
|
:try_start_c
|
|
invoke-virtual {v0}, Ljava/io/InputStream;->close()V
|
|
:try_end_c
|
|
.catch Ljava/io/IOException; {:try_start_c .. :try_end_c} :catch_6
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_c .. :try_end_c} :catch_8
|
|
|
|
goto :goto_8
|
|
|
|
:catch_6
|
|
move-exception v0
|
|
|
|
.line 834
|
|
:try_start_d
|
|
invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_d
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_d .. :try_end_d} :catch_8
|
|
|
|
:goto_8
|
|
if-eqz p0, :cond_4
|
|
|
|
.line 838
|
|
:try_start_e
|
|
invoke-virtual {p0}, Ljava/io/ByteArrayOutputStream;->close()V
|
|
:try_end_e
|
|
.catch Ljava/io/IOException; {:try_start_e .. :try_end_e} :catch_7
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_e .. :try_end_e} :catch_8
|
|
|
|
goto :goto_9
|
|
|
|
:catch_7
|
|
move-exception p0
|
|
|
|
.line 841
|
|
:try_start_f
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
.line 843
|
|
:cond_4
|
|
:goto_9
|
|
throw p1
|
|
:try_end_f
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_f .. :try_end_f} :catch_8
|
|
|
|
:catch_8
|
|
move-exception p0
|
|
|
|
.line 845
|
|
invoke-virtual {p0}, Ljava/io/FileNotFoundException;->printStackTrace()V
|
|
|
|
return-object v1
|
|
.end method
|
|
|
|
.method public static readFile2BytesByStream(Ljava/lang/String;)[B
|
|
.locals 1
|
|
|
|
.line 766
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static {p0, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2BytesByStream(Ljava/io/File;Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)[B
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2BytesByStream(Ljava/lang/String;Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)[B
|
|
.locals 0
|
|
|
|
.line 792
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0, p1}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2BytesByStream(Ljava/io/File;Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)[B
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2List(Ljava/io/File;)Ljava/util/List;
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/io/File;",
|
|
")",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const v1, 0x7fffffff
|
|
|
|
const/4 v2, 0x0
|
|
|
|
.line 601
|
|
invoke-static {p0, v0, v1, v2}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2List(Ljava/io/File;IILjava/lang/String;)Ljava/util/List;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2List(Ljava/io/File;II)Ljava/util/List;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/io/File;",
|
|
"II)",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 652
|
|
invoke-static {p0, p1, p2, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2List(Ljava/io/File;IILjava/lang/String;)Ljava/util/List;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2List(Ljava/io/File;IILjava/lang/String;)Ljava/util/List;
|
|
.locals 6
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/io/File;",
|
|
"II",
|
|
"Ljava/lang/String;",
|
|
")",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
.line 668
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->isFileExists(Ljava/io/File;)Z
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
return-object v1
|
|
|
|
:cond_0
|
|
if-le p1, p2, :cond_1
|
|
|
|
return-object v1
|
|
|
|
.line 674
|
|
:cond_1
|
|
:try_start_0
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
.line 675
|
|
invoke-static {p3}, Lcom/blankj/utilcode/util/UtilsBridge;->isSpace(Ljava/lang/String;)Z
|
|
|
|
move-result v2
|
|
|
|
const/4 v3, 0x1
|
|
|
|
if-eqz v2, :cond_2
|
|
|
|
.line 676
|
|
new-instance p3, Ljava/io/BufferedReader;
|
|
|
|
new-instance v2, Ljava/io/InputStreamReader;
|
|
|
|
new-instance v4, Ljava/io/FileInputStream;
|
|
|
|
invoke-direct {v4, p0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
|
|
|
|
invoke-direct {v2, v4}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V
|
|
|
|
invoke-direct {p3, v2}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
|
|
|
|
goto :goto_0
|
|
|
|
.line 678
|
|
:cond_2
|
|
new-instance v2, Ljava/io/BufferedReader;
|
|
|
|
new-instance v4, Ljava/io/InputStreamReader;
|
|
|
|
new-instance v5, Ljava/io/FileInputStream;
|
|
|
|
invoke-direct {v5, p0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
|
|
|
|
invoke-direct {v4, v5, p3}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;Ljava/lang/String;)V
|
|
|
|
invoke-direct {v2, v4}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
|
|
:try_end_0
|
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_2
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
move-object p3, v2
|
|
|
|
.line 682
|
|
:goto_0
|
|
:try_start_1
|
|
invoke-virtual {p3}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
if-eqz p0, :cond_5
|
|
|
|
if-le v3, p2, :cond_3
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
if-gt p1, v3, :cond_4
|
|
|
|
if-gt v3, p2, :cond_4
|
|
|
|
.line 684
|
|
invoke-interface {v0, p0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
:try_end_1
|
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_1
|
|
|
|
:cond_4
|
|
add-int/lit8 v3, v3, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_5
|
|
:goto_1
|
|
if-eqz p3, :cond_6
|
|
|
|
.line 694
|
|
:try_start_2
|
|
invoke-virtual {p3}, Ljava/io/BufferedReader;->close()V
|
|
:try_end_2
|
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
|
|
|
|
goto :goto_2
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 697
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_6
|
|
:goto_2
|
|
return-object v0
|
|
|
|
:catch_1
|
|
move-exception p0
|
|
|
|
goto :goto_3
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
goto :goto_5
|
|
|
|
:catch_2
|
|
move-exception p0
|
|
|
|
move-object p3, v1
|
|
|
|
.line 689
|
|
:goto_3
|
|
:try_start_3
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_3
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_1
|
|
|
|
if-eqz p3, :cond_7
|
|
|
|
.line 694
|
|
:try_start_4
|
|
invoke-virtual {p3}, Ljava/io/BufferedReader;->close()V
|
|
:try_end_4
|
|
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_3
|
|
|
|
goto :goto_4
|
|
|
|
:catch_3
|
|
move-exception p0
|
|
|
|
.line 697
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_7
|
|
:goto_4
|
|
return-object v1
|
|
|
|
:catchall_1
|
|
move-exception p0
|
|
|
|
move-object v1, p3
|
|
|
|
:goto_5
|
|
if-eqz v1, :cond_8
|
|
|
|
.line 694
|
|
:try_start_5
|
|
invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V
|
|
:try_end_5
|
|
.catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_4
|
|
|
|
goto :goto_6
|
|
|
|
:catch_4
|
|
move-exception p1
|
|
|
|
.line 697
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
.line 699
|
|
:cond_8
|
|
:goto_6
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static readFile2List(Ljava/io/File;Ljava/lang/String;)Ljava/util/List;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/io/File;",
|
|
"Ljava/lang/String;",
|
|
")",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const v1, 0x7fffffff
|
|
|
|
.line 612
|
|
invoke-static {p0, v0, v1, p1}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2List(Ljava/io/File;IILjava/lang/String;)Ljava/util/List;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2List(Ljava/lang/String;)Ljava/util/List;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/String;",
|
|
")",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
.line 580
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static {p0, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2List(Ljava/io/File;Ljava/lang/String;)Ljava/util/List;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2List(Ljava/lang/String;II)Ljava/util/List;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/String;",
|
|
"II)",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
.line 624
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static {p0, p1, p2, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2List(Ljava/io/File;IILjava/lang/String;)Ljava/util/List;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2List(Ljava/lang/String;IILjava/lang/String;)Ljava/util/List;
|
|
.locals 0
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/String;",
|
|
"II",
|
|
"Ljava/lang/String;",
|
|
")",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
.line 640
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0, p1, p2, p3}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2List(Ljava/io/File;IILjava/lang/String;)Ljava/util/List;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2List(Ljava/lang/String;Ljava/lang/String;)Ljava/util/List;
|
|
.locals 0
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/String;",
|
|
")",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
.line 591
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0, p1}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2List(Ljava/io/File;Ljava/lang/String;)Ljava/util/List;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2String(Ljava/io/File;)Ljava/lang/String;
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 730
|
|
invoke-static {p0, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2String(Ljava/io/File;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2String(Ljava/io/File;Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 1
|
|
|
|
.line 741
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2BytesByStream(Ljava/io/File;)[B
|
|
|
|
move-result-object p0
|
|
|
|
if-nez p0, :cond_0
|
|
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
|
|
.line 743
|
|
:cond_0
|
|
invoke-static {p1}, Lcom/blankj/utilcode/util/UtilsBridge;->isSpace(Ljava/lang/String;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
.line 744
|
|
new-instance p1, Ljava/lang/String;
|
|
|
|
invoke-direct {p1, p0}, Ljava/lang/String;-><init>([B)V
|
|
|
|
return-object p1
|
|
|
|
.line 747
|
|
:cond_1
|
|
:try_start_0
|
|
new-instance v0, Ljava/lang/String;
|
|
|
|
invoke-direct {v0, p0, p1}, Ljava/lang/String;-><init>([BLjava/lang/String;)V
|
|
:try_end_0
|
|
.catch Ljava/io/UnsupportedEncodingException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object v0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 749
|
|
invoke-virtual {p0}, Ljava/io/UnsupportedEncodingException;->printStackTrace()V
|
|
|
|
const-string p0, ""
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2String(Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 1
|
|
|
|
.line 709
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static {p0, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2String(Ljava/io/File;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static readFile2String(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 0
|
|
|
|
.line 720
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0, p1}, Lcom/blankj/utilcode/util/FileIOUtils;->readFile2String(Ljava/io/File;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static setBufferSize(I)V
|
|
.locals 0
|
|
|
|
.line 945
|
|
sput p0, Lcom/blankj/utilcode/util/FileIOUtils;->sBufferSize:I
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByChannel(Ljava/io/File;[BZ)Z
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 363
|
|
invoke-static {p0, p1, v0, p2}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByChannel(Ljava/io/File;[BZZ)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByChannel(Ljava/io/File;[BZZ)Z
|
|
.locals 5
|
|
|
|
const-string v0, "FileIOUtils"
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
const-string p0, "bytes is null."
|
|
|
|
.line 380
|
|
invoke-static {v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
return v1
|
|
|
|
.line 383
|
|
:cond_0
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->createOrExistsFile(Ljava/io/File;)Z
|
|
|
|
move-result v2
|
|
|
|
if-nez v2, :cond_1
|
|
|
|
.line 384
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string p2, "create file <"
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, "> failed."
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
return v1
|
|
|
|
:cond_1
|
|
const/4 v2, 0x0
|
|
|
|
.line 389
|
|
:try_start_0
|
|
new-instance v3, Ljava/io/FileOutputStream;
|
|
|
|
invoke-direct {v3, p0, p2}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;Z)V
|
|
|
|
invoke-virtual {v3}, Ljava/io/FileOutputStream;->getChannel()Ljava/nio/channels/FileChannel;
|
|
|
|
move-result-object v2
|
|
|
|
if-nez v2, :cond_3
|
|
|
|
const-string p0, "fc is null."
|
|
|
|
.line 391
|
|
invoke-static {v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
|
:try_end_0
|
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_2
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
if-eqz v2, :cond_2
|
|
|
|
.line 404
|
|
:try_start_1
|
|
invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_1
|
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 407
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_2
|
|
:goto_0
|
|
return v1
|
|
|
|
.line 394
|
|
:cond_3
|
|
:try_start_2
|
|
invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->size()J
|
|
|
|
move-result-wide v3
|
|
|
|
invoke-virtual {v2, v3, v4}, Ljava/nio/channels/FileChannel;->position(J)Ljava/nio/channels/FileChannel;
|
|
|
|
.line 395
|
|
invoke-static {p1}, Ljava/nio/ByteBuffer;->wrap([B)Ljava/nio/ByteBuffer;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {v2, p0}, Ljava/nio/channels/FileChannel;->write(Ljava/nio/ByteBuffer;)I
|
|
|
|
const/4 p0, 0x1
|
|
|
|
if-eqz p3, :cond_4
|
|
|
|
.line 396
|
|
invoke-virtual {v2, p0}, Ljava/nio/channels/FileChannel;->force(Z)V
|
|
:try_end_2
|
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_2
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
|
|
|
:cond_4
|
|
if-eqz v2, :cond_5
|
|
|
|
.line 404
|
|
:try_start_3
|
|
invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_3
|
|
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_1
|
|
|
|
goto :goto_1
|
|
|
|
:catch_1
|
|
move-exception p1
|
|
|
|
.line 407
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_5
|
|
:goto_1
|
|
return p0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
goto :goto_3
|
|
|
|
:catch_2
|
|
move-exception p0
|
|
|
|
.line 399
|
|
:try_start_4
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_4
|
|
.catchall {:try_start_4 .. :try_end_4} :catchall_0
|
|
|
|
if-eqz v2, :cond_6
|
|
|
|
.line 404
|
|
:try_start_5
|
|
invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_5
|
|
.catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_3
|
|
|
|
goto :goto_2
|
|
|
|
:catch_3
|
|
move-exception p0
|
|
|
|
.line 407
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_6
|
|
:goto_2
|
|
return v1
|
|
|
|
:goto_3
|
|
if-eqz v2, :cond_7
|
|
|
|
.line 404
|
|
:try_start_6
|
|
invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_6
|
|
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_4
|
|
|
|
goto :goto_4
|
|
|
|
:catch_4
|
|
move-exception p1
|
|
|
|
.line 407
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
.line 409
|
|
:cond_7
|
|
:goto_4
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByChannel(Ljava/lang/String;[BZ)Z
|
|
.locals 1
|
|
|
|
.line 333
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static {p0, p1, v0, p2}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByChannel(Ljava/io/File;[BZZ)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByChannel(Ljava/lang/String;[BZZ)Z
|
|
.locals 0
|
|
|
|
.line 349
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0, p1, p2, p3}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByChannel(Ljava/io/File;[BZZ)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByMap(Ljava/io/File;[BZ)Z
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 453
|
|
invoke-static {p0, p1, v0, p2}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByMap(Ljava/io/File;[BZZ)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByMap(Ljava/io/File;[BZZ)Z
|
|
.locals 10
|
|
|
|
const-string v0, "FileIOUtils"
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-eqz p1, :cond_7
|
|
|
|
.line 469
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->createOrExistsFile(Ljava/io/File;)Z
|
|
|
|
move-result v2
|
|
|
|
if-nez v2, :cond_0
|
|
|
|
goto :goto_5
|
|
|
|
:cond_0
|
|
const/4 v2, 0x0
|
|
|
|
.line 475
|
|
:try_start_0
|
|
new-instance v3, Ljava/io/FileOutputStream;
|
|
|
|
invoke-direct {v3, p0, p2}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;Z)V
|
|
|
|
invoke-virtual {v3}, Ljava/io/FileOutputStream;->getChannel()Ljava/nio/channels/FileChannel;
|
|
|
|
move-result-object v2
|
|
|
|
if-nez v2, :cond_2
|
|
|
|
const-string p0, "fc is null."
|
|
|
|
.line 477
|
|
invoke-static {v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
|
:try_end_0
|
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_2
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
if-eqz v2, :cond_1
|
|
|
|
.line 490
|
|
:try_start_1
|
|
invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_1
|
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 493
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_1
|
|
:goto_0
|
|
return v1
|
|
|
|
.line 480
|
|
:cond_2
|
|
:try_start_2
|
|
sget-object v5, Ljava/nio/channels/FileChannel$MapMode;->READ_WRITE:Ljava/nio/channels/FileChannel$MapMode;
|
|
|
|
invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->size()J
|
|
|
|
move-result-wide v6
|
|
|
|
array-length p0, p1
|
|
|
|
int-to-long v8, p0
|
|
|
|
move-object v4, v2
|
|
|
|
invoke-virtual/range {v4 .. v9}, Ljava/nio/channels/FileChannel;->map(Ljava/nio/channels/FileChannel$MapMode;JJ)Ljava/nio/MappedByteBuffer;
|
|
|
|
move-result-object p0
|
|
|
|
.line 481
|
|
invoke-virtual {p0, p1}, Ljava/nio/MappedByteBuffer;->put([B)Ljava/nio/ByteBuffer;
|
|
|
|
if-eqz p3, :cond_3
|
|
|
|
.line 482
|
|
invoke-virtual {p0}, Ljava/nio/MappedByteBuffer;->force()Ljava/nio/MappedByteBuffer;
|
|
:try_end_2
|
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_2
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
|
|
|
:cond_3
|
|
const/4 p0, 0x1
|
|
|
|
if-eqz v2, :cond_4
|
|
|
|
.line 490
|
|
:try_start_3
|
|
invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_3
|
|
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_1
|
|
|
|
goto :goto_1
|
|
|
|
:catch_1
|
|
move-exception p1
|
|
|
|
.line 493
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_4
|
|
:goto_1
|
|
return p0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
goto :goto_3
|
|
|
|
:catch_2
|
|
move-exception p0
|
|
|
|
.line 485
|
|
:try_start_4
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_4
|
|
.catchall {:try_start_4 .. :try_end_4} :catchall_0
|
|
|
|
if-eqz v2, :cond_5
|
|
|
|
.line 490
|
|
:try_start_5
|
|
invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_5
|
|
.catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_3
|
|
|
|
goto :goto_2
|
|
|
|
:catch_3
|
|
move-exception p0
|
|
|
|
.line 493
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_5
|
|
:goto_2
|
|
return v1
|
|
|
|
:goto_3
|
|
if-eqz v2, :cond_6
|
|
|
|
.line 490
|
|
:try_start_6
|
|
invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->close()V
|
|
:try_end_6
|
|
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_4
|
|
|
|
goto :goto_4
|
|
|
|
:catch_4
|
|
move-exception p1
|
|
|
|
.line 493
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
.line 495
|
|
:cond_6
|
|
:goto_4
|
|
throw p0
|
|
|
|
.line 470
|
|
:cond_7
|
|
:goto_5
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string p2, "create file <"
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, "> failed."
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
return v1
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByMap(Ljava/lang/String;[BZ)Z
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 423
|
|
invoke-static {p0, p1, v0, p2}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByMap(Ljava/lang/String;[BZZ)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByMap(Ljava/lang/String;[BZZ)Z
|
|
.locals 0
|
|
|
|
.line 439
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0, p1, p2, p3}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByMap(Ljava/io/File;[BZZ)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByStream(Ljava/io/File;[B)Z
|
|
.locals 2
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
.line 240
|
|
invoke-static {p0, p1, v0, v1}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByStream(Ljava/io/File;[BZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByStream(Ljava/io/File;[BLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 302
|
|
invoke-static {p0, p1, v0, p2}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByStream(Ljava/io/File;[BZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByStream(Ljava/io/File;[BZ)Z
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 254
|
|
invoke-static {p0, p1, p2, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByStream(Ljava/io/File;[BZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByStream(Ljava/io/File;[BZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
.locals 1
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
const/4 p0, 0x0
|
|
|
|
return p0
|
|
|
|
.line 319
|
|
:cond_0
|
|
new-instance v0, Ljava/io/ByteArrayInputStream;
|
|
|
|
invoke-direct {v0, p1}, Ljava/io/ByteArrayInputStream;-><init>([B)V
|
|
|
|
invoke-static {p0, v0, p2, p3}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;ZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByStream(Ljava/lang/String;[B)Z
|
|
.locals 2
|
|
|
|
.line 215
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-static {p0, p1, v0, v1}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByStream(Ljava/io/File;[BZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByStream(Ljava/lang/String;[BLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
.locals 1
|
|
|
|
.line 272
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static {p0, p1, v0, p2}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByStream(Ljava/io/File;[BZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByStream(Ljava/lang/String;[BZ)Z
|
|
.locals 1
|
|
|
|
.line 229
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static {p0, p1, p2, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByStream(Ljava/io/File;[BZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromBytesByStream(Ljava/lang/String;[BZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
.locals 0
|
|
|
|
.line 288
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0, p1, p2, p3}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromBytesByStream(Ljava/io/File;[BZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;)Z
|
|
.locals 2
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
.line 81
|
|
invoke-static {p0, p1, v0, v1}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;ZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 143
|
|
invoke-static {p0, p1, v0, p2}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;ZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;Z)Z
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 95
|
|
invoke-static {p0, p1, p2, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;ZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;ZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
.locals 7
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_5
|
|
|
|
.line 159
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->createOrExistsFile(Ljava/io/File;)Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
goto/16 :goto_a
|
|
|
|
:cond_0
|
|
const/4 v1, 0x0
|
|
|
|
.line 165
|
|
:try_start_0
|
|
new-instance v2, Ljava/io/BufferedOutputStream;
|
|
|
|
new-instance v3, Ljava/io/FileOutputStream;
|
|
|
|
invoke-direct {v3, p0, p2}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;Z)V
|
|
|
|
sget p0, Lcom/blankj/utilcode/util/FileIOUtils;->sBufferSize:I
|
|
|
|
invoke-direct {v2, v3, p0}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;I)V
|
|
:try_end_0
|
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_3
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_1
|
|
|
|
const/4 p0, -0x1
|
|
|
|
if-nez p3, :cond_1
|
|
|
|
.line 167
|
|
:try_start_1
|
|
sget p2, Lcom/blankj/utilcode/util/FileIOUtils;->sBufferSize:I
|
|
|
|
new-array p2, p2, [B
|
|
|
|
.line 168
|
|
:goto_0
|
|
invoke-virtual {p1, p2}, Ljava/io/InputStream;->read([B)I
|
|
|
|
move-result p3
|
|
|
|
if-eq p3, p0, :cond_2
|
|
|
|
.line 169
|
|
invoke-virtual {v2, p2, v0, p3}, Ljava/io/OutputStream;->write([BII)V
|
|
|
|
goto :goto_0
|
|
|
|
.line 172
|
|
:cond_1
|
|
invoke-virtual {p1}, Ljava/io/InputStream;->available()I
|
|
|
|
move-result p2
|
|
|
|
int-to-double v3, p2
|
|
|
|
const-wide/16 v5, 0x0
|
|
|
|
.line 174
|
|
invoke-interface {p3, v5, v6}, Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;->onProgressUpdate(D)V
|
|
|
|
.line 175
|
|
sget p2, Lcom/blankj/utilcode/util/FileIOUtils;->sBufferSize:I
|
|
|
|
new-array p2, p2, [B
|
|
|
|
move v1, v0
|
|
|
|
.line 176
|
|
:goto_1
|
|
invoke-virtual {p1, p2}, Ljava/io/InputStream;->read([B)I
|
|
|
|
move-result v5
|
|
|
|
if-eq v5, p0, :cond_2
|
|
|
|
.line 177
|
|
invoke-virtual {v2, p2, v0, v5}, Ljava/io/OutputStream;->write([BII)V
|
|
|
|
add-int/2addr v1, v5
|
|
|
|
int-to-double v5, v1
|
|
|
|
div-double/2addr v5, v3
|
|
|
|
.line 179
|
|
invoke-interface {p3, v5, v6}, Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;->onProgressUpdate(D)V
|
|
:try_end_1
|
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_2
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
const/4 p0, 0x1
|
|
|
|
.line 188
|
|
:try_start_2
|
|
invoke-virtual {p1}, Ljava/io/InputStream;->close()V
|
|
:try_end_2
|
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
|
|
|
|
goto :goto_2
|
|
|
|
:catch_0
|
|
move-exception p1
|
|
|
|
.line 190
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
.line 194
|
|
:goto_2
|
|
:try_start_3
|
|
invoke-virtual {v2}, Ljava/io/OutputStream;->close()V
|
|
:try_end_3
|
|
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_1
|
|
|
|
goto :goto_3
|
|
|
|
:catch_1
|
|
move-exception p1
|
|
|
|
.line 197
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:goto_3
|
|
return p0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
move-object v1, v2
|
|
|
|
goto :goto_7
|
|
|
|
:catch_2
|
|
move-exception p0
|
|
|
|
move-object v1, v2
|
|
|
|
goto :goto_4
|
|
|
|
:catchall_1
|
|
move-exception p0
|
|
|
|
goto :goto_7
|
|
|
|
:catch_3
|
|
move-exception p0
|
|
|
|
.line 184
|
|
:goto_4
|
|
:try_start_4
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_4
|
|
.catchall {:try_start_4 .. :try_end_4} :catchall_1
|
|
|
|
.line 188
|
|
:try_start_5
|
|
invoke-virtual {p1}, Ljava/io/InputStream;->close()V
|
|
:try_end_5
|
|
.catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_4
|
|
|
|
goto :goto_5
|
|
|
|
:catch_4
|
|
move-exception p0
|
|
|
|
.line 190
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:goto_5
|
|
if-eqz v1, :cond_3
|
|
|
|
.line 194
|
|
:try_start_6
|
|
invoke-virtual {v1}, Ljava/io/OutputStream;->close()V
|
|
:try_end_6
|
|
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_5
|
|
|
|
goto :goto_6
|
|
|
|
:catch_5
|
|
move-exception p0
|
|
|
|
.line 197
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_3
|
|
:goto_6
|
|
return v0
|
|
|
|
.line 188
|
|
:goto_7
|
|
:try_start_7
|
|
invoke-virtual {p1}, Ljava/io/InputStream;->close()V
|
|
:try_end_7
|
|
.catch Ljava/io/IOException; {:try_start_7 .. :try_end_7} :catch_6
|
|
|
|
goto :goto_8
|
|
|
|
:catch_6
|
|
move-exception p1
|
|
|
|
.line 190
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:goto_8
|
|
if-eqz v1, :cond_4
|
|
|
|
.line 194
|
|
:try_start_8
|
|
invoke-virtual {v1}, Ljava/io/OutputStream;->close()V
|
|
:try_end_8
|
|
.catch Ljava/io/IOException; {:try_start_8 .. :try_end_8} :catch_7
|
|
|
|
goto :goto_9
|
|
|
|
:catch_7
|
|
move-exception p1
|
|
|
|
.line 197
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
.line 199
|
|
:cond_4
|
|
:goto_9
|
|
throw p0
|
|
|
|
.line 160
|
|
:cond_5
|
|
:goto_a
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string p2, "create file <"
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, "> failed."
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, "FileIOUtils"
|
|
|
|
invoke-static {p1, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public static writeFileFromIS(Ljava/lang/String;Ljava/io/InputStream;)Z
|
|
.locals 2
|
|
|
|
.line 56
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-static {p0, p1, v0, v1}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;ZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromIS(Ljava/lang/String;Ljava/io/InputStream;Lcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
.locals 1
|
|
|
|
.line 113
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static {p0, p1, v0, p2}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;ZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromIS(Ljava/lang/String;Ljava/io/InputStream;Z)Z
|
|
.locals 1
|
|
|
|
.line 70
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static {p0, p1, p2, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;ZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromIS(Ljava/lang/String;Ljava/io/InputStream;ZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
.locals 0
|
|
|
|
.line 129
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0, p1, p2, p3}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromIS(Ljava/io/File;Ljava/io/InputStream;ZLcom/blankj/utilcode/util/FileIOUtils$OnProgressUpdateListener;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromString(Ljava/io/File;Ljava/lang/String;)Z
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 531
|
|
invoke-static {p0, p1, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromString(Ljava/io/File;Ljava/lang/String;Z)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromString(Ljava/io/File;Ljava/lang/String;Z)Z
|
|
.locals 4
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p0, :cond_4
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
goto :goto_5
|
|
|
|
.line 546
|
|
:cond_0
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->createOrExistsFile(Ljava/io/File;)Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_1
|
|
|
|
.line 547
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string p2, "create file <"
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, "> failed."
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, "FileIOUtils"
|
|
|
|
invoke-static {p1, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
return v0
|
|
|
|
:cond_1
|
|
const/4 v1, 0x0
|
|
|
|
.line 552
|
|
:try_start_0
|
|
new-instance v2, Ljava/io/BufferedWriter;
|
|
|
|
new-instance v3, Ljava/io/FileWriter;
|
|
|
|
invoke-direct {v3, p0, p2}, Ljava/io/FileWriter;-><init>(Ljava/io/File;Z)V
|
|
|
|
invoke-direct {v2, v3}, Ljava/io/BufferedWriter;-><init>(Ljava/io/Writer;)V
|
|
:try_end_0
|
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_2
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_1
|
|
|
|
.line 553
|
|
:try_start_1
|
|
invoke-virtual {v2, p1}, Ljava/io/BufferedWriter;->write(Ljava/lang/String;)V
|
|
:try_end_1
|
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
const/4 p0, 0x1
|
|
|
|
.line 561
|
|
:try_start_2
|
|
invoke-virtual {v2}, Ljava/io/BufferedWriter;->close()V
|
|
:try_end_2
|
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p1
|
|
|
|
.line 564
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:goto_0
|
|
return p0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
move-object v1, v2
|
|
|
|
goto :goto_3
|
|
|
|
:catch_1
|
|
move-exception p0
|
|
|
|
move-object v1, v2
|
|
|
|
goto :goto_1
|
|
|
|
:catchall_1
|
|
move-exception p0
|
|
|
|
goto :goto_3
|
|
|
|
:catch_2
|
|
move-exception p0
|
|
|
|
.line 556
|
|
:goto_1
|
|
:try_start_3
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
:try_end_3
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_1
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
.line 561
|
|
:try_start_4
|
|
invoke-virtual {v1}, Ljava/io/BufferedWriter;->close()V
|
|
:try_end_4
|
|
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_3
|
|
|
|
goto :goto_2
|
|
|
|
:catch_3
|
|
move-exception p0
|
|
|
|
.line 564
|
|
invoke-virtual {p0}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
:cond_2
|
|
:goto_2
|
|
return v0
|
|
|
|
:goto_3
|
|
if-eqz v1, :cond_3
|
|
|
|
.line 561
|
|
:try_start_5
|
|
invoke-virtual {v1}, Ljava/io/BufferedWriter;->close()V
|
|
:try_end_5
|
|
.catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_4
|
|
|
|
goto :goto_4
|
|
|
|
:catch_4
|
|
move-exception p1
|
|
|
|
.line 564
|
|
invoke-virtual {p1}, Ljava/io/IOException;->printStackTrace()V
|
|
|
|
.line 566
|
|
:cond_3
|
|
:goto_4
|
|
throw p0
|
|
|
|
:cond_4
|
|
:goto_5
|
|
return v0
|
|
.end method
|
|
|
|
.method public static writeFileFromString(Ljava/lang/String;Ljava/lang/String;)Z
|
|
.locals 1
|
|
|
|
.line 506
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static {p0, p1, v0}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromString(Ljava/io/File;Ljava/lang/String;Z)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static writeFileFromString(Ljava/lang/String;Ljava/lang/String;Z)Z
|
|
.locals 0
|
|
|
|
.line 520
|
|
invoke-static {p0}, Lcom/blankj/utilcode/util/UtilsBridge;->getFileByPath(Ljava/lang/String;)Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0, p1, p2}, Lcom/blankj/utilcode/util/FileIOUtils;->writeFileFromString(Ljava/io/File;Ljava/lang/String;Z)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|