mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 01:22:33 -06:00
475 lines
9.7 KiB
Smali
475 lines
9.7 KiB
Smali
.class public final Lio/sentry/util/FileUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "FileUtils.java"
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 14
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static deleteRecursively(Ljava/io/File;)Z
|
|
.locals 5
|
|
|
|
const/4 v0, 0x1
|
|
|
|
if-eqz p0, :cond_5
|
|
|
|
.line 25
|
|
invoke-virtual {p0}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
goto :goto_1
|
|
|
|
.line 28
|
|
:cond_0
|
|
invoke-virtual {p0}, Ljava/io/File;->isFile()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
.line 29
|
|
invoke-virtual {p0}, Ljava/io/File;->delete()Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
|
|
.line 31
|
|
:cond_1
|
|
invoke-virtual {p0}, Ljava/io/File;->listFiles()[Ljava/io/File;
|
|
|
|
move-result-object v1
|
|
|
|
if-nez v1, :cond_2
|
|
|
|
return v0
|
|
|
|
.line 33
|
|
:cond_2
|
|
array-length v0, v1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
move v3, v2
|
|
|
|
:goto_0
|
|
if-ge v3, v0, :cond_4
|
|
|
|
aget-object v4, v1, v3
|
|
|
|
.line 34
|
|
invoke-static {v4}, Lio/sentry/util/FileUtils;->deleteRecursively(Ljava/io/File;)Z
|
|
|
|
move-result v4
|
|
|
|
if-nez v4, :cond_3
|
|
|
|
return v2
|
|
|
|
:cond_3
|
|
add-int/lit8 v3, v3, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
.line 36
|
|
:cond_4
|
|
invoke-virtual {p0}, Ljava/io/File;->delete()Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
|
|
:cond_5
|
|
:goto_1
|
|
return v0
|
|
.end method
|
|
|
|
.method public static readBytesFromFile(Ljava/lang/String;J)[B
|
|
.locals 4
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;,
|
|
Ljava/lang/SecurityException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 78
|
|
new-instance v0, Ljava/io/File;
|
|
|
|
invoke-direct {v0, p0}, Ljava/io/File;-><init>(Ljava/lang/String;)V
|
|
|
|
.line 80
|
|
invoke-virtual {v0}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_4
|
|
|
|
.line 84
|
|
invoke-virtual {v0}, Ljava/io/File;->isFile()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_3
|
|
|
|
.line 89
|
|
invoke-virtual {v0}, Ljava/io/File;->canRead()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
.line 94
|
|
invoke-virtual {v0}, Ljava/io/File;->length()J
|
|
|
|
move-result-wide v1
|
|
|
|
cmp-long v1, v1, p1
|
|
|
|
if-gtz v1, :cond_1
|
|
|
|
.line 102
|
|
new-instance p1, Ljava/io/FileInputStream;
|
|
|
|
invoke-direct {p1, p0}, Ljava/io/FileInputStream;-><init>(Ljava/lang/String;)V
|
|
|
|
.line 103
|
|
:try_start_0
|
|
new-instance p0, Ljava/io/BufferedInputStream;
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/BufferedInputStream;-><init>(Ljava/io/InputStream;)V
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_4
|
|
|
|
.line 104
|
|
:try_start_1
|
|
new-instance p2, Ljava/io/ByteArrayOutputStream;
|
|
|
|
invoke-direct {p2}, Ljava/io/ByteArrayOutputStream;-><init>()V
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_2
|
|
|
|
const/16 v0, 0x400
|
|
|
|
:try_start_2
|
|
new-array v0, v0, [B
|
|
|
|
.line 108
|
|
:goto_0
|
|
invoke-virtual {p0, v0}, Ljava/io/BufferedInputStream;->read([B)I
|
|
|
|
move-result v1
|
|
|
|
const/4 v2, -0x1
|
|
|
|
if-eq v1, v2, :cond_0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
.line 109
|
|
invoke-virtual {p2, v0, v2, v1}, Ljava/io/ByteArrayOutputStream;->write([BII)V
|
|
|
|
goto :goto_0
|
|
|
|
.line 111
|
|
:cond_0
|
|
invoke-virtual {p2}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
|
|
|
|
move-result-object v0
|
|
:try_end_2
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
|
|
|
.line 112
|
|
:try_start_3
|
|
invoke-virtual {p2}, Ljava/io/ByteArrayOutputStream;->close()V
|
|
:try_end_3
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_2
|
|
|
|
:try_start_4
|
|
invoke-virtual {p0}, Ljava/io/BufferedInputStream;->close()V
|
|
:try_end_4
|
|
.catchall {:try_start_4 .. :try_end_4} :catchall_4
|
|
|
|
invoke-virtual {p1}, Ljava/io/FileInputStream;->close()V
|
|
|
|
return-object v0
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
.line 102
|
|
:try_start_5
|
|
invoke-virtual {p2}, Ljava/io/ByteArrayOutputStream;->close()V
|
|
:try_end_5
|
|
.catchall {:try_start_5 .. :try_end_5} :catchall_1
|
|
|
|
goto :goto_1
|
|
|
|
:catchall_1
|
|
move-exception p2
|
|
|
|
:try_start_6
|
|
invoke-virtual {v0, p2}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
|
|
|
|
:goto_1
|
|
throw v0
|
|
:try_end_6
|
|
.catchall {:try_start_6 .. :try_end_6} :catchall_2
|
|
|
|
:catchall_2
|
|
move-exception p2
|
|
|
|
:try_start_7
|
|
invoke-virtual {p0}, Ljava/io/BufferedInputStream;->close()V
|
|
:try_end_7
|
|
.catchall {:try_start_7 .. :try_end_7} :catchall_3
|
|
|
|
goto :goto_2
|
|
|
|
:catchall_3
|
|
move-exception p0
|
|
|
|
:try_start_8
|
|
invoke-virtual {p2, p0}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
|
|
|
|
:goto_2
|
|
throw p2
|
|
:try_end_8
|
|
.catchall {:try_start_8 .. :try_end_8} :catchall_4
|
|
|
|
:catchall_4
|
|
move-exception p0
|
|
|
|
:try_start_9
|
|
invoke-virtual {p1}, Ljava/io/FileInputStream;->close()V
|
|
:try_end_9
|
|
.catchall {:try_start_9 .. :try_end_9} :catchall_5
|
|
|
|
goto :goto_3
|
|
|
|
:catchall_5
|
|
move-exception p1
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
|
|
|
|
:goto_3
|
|
throw p0
|
|
|
|
.line 95
|
|
:cond_1
|
|
new-instance v1, Ljava/io/IOException;
|
|
|
|
.line 99
|
|
invoke-virtual {v0}, Ljava/io/File;->length()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object p1
|
|
|
|
filled-new-array {p0, v0, p1}, [Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, "Reading file failed, because size located at \'%s\' with %d bytes is bigger than the maximum allowed size of %d bytes."
|
|
|
|
.line 96
|
|
invoke-static {p1, p0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-direct {v1, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v1
|
|
|
|
.line 90
|
|
:cond_2
|
|
new-instance p1, Ljava/io/IOException;
|
|
|
|
const-string p2, "Reading the item %s failed, because can\'t read the file."
|
|
|
|
filled-new-array {p0}, [Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
.line 91
|
|
invoke-static {p2, p0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-direct {p1, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
|
|
.line 85
|
|
:cond_3
|
|
new-instance p1, Ljava/io/IOException;
|
|
|
|
const-string p2, "Reading path %s failed, because it\'s not a file."
|
|
|
|
filled-new-array {p0}, [Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
.line 86
|
|
invoke-static {p2, p0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-direct {p1, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
|
|
.line 81
|
|
:cond_4
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
invoke-virtual {v0}, Ljava/io/File;->getName()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
filled-new-array {p1}, [Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "File \'%s\' doesn\'t exists"
|
|
|
|
invoke-static {p2, p1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static readText(Ljava/io/File;)Ljava/lang/String;
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
if-eqz p0, :cond_3
|
|
|
|
.line 49
|
|
invoke-virtual {p0}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
invoke-virtual {p0}, Ljava/io/File;->isFile()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
invoke-virtual {p0}, Ljava/io/File;->canRead()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
goto :goto_2
|
|
|
|
.line 52
|
|
:cond_0
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
.line 53
|
|
new-instance v1, Ljava/io/BufferedReader;
|
|
|
|
new-instance v2, Ljava/io/FileReader;
|
|
|
|
invoke-direct {v2, p0}, Ljava/io/FileReader;-><init>(Ljava/io/File;)V
|
|
|
|
invoke-direct {v1, v2}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
|
|
|
|
.line 57
|
|
:try_start_0
|
|
invoke-virtual {v1}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
.line 58
|
|
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
.line 60
|
|
:cond_1
|
|
:goto_0
|
|
invoke-virtual {v1}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
if-eqz p0, :cond_2
|
|
|
|
const-string v2, "\n"
|
|
|
|
.line 61
|
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v2, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
goto :goto_0
|
|
|
|
.line 63
|
|
:cond_2
|
|
invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V
|
|
|
|
.line 64
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
.line 53
|
|
:try_start_1
|
|
invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_1
|
|
|
|
goto :goto_1
|
|
|
|
:catchall_1
|
|
move-exception v0
|
|
|
|
invoke-virtual {p0, v0}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
|
|
|
|
:goto_1
|
|
throw p0
|
|
|
|
:cond_3
|
|
:goto_2
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
.end method
|