CFileUtil.smali

.class public Lcom/cleanmaster/hpsharelib/service/acc4install/CFileUtil;
.super Ljava/lang/Object;
.source "CFileUtil.java"


# static fields
.field private static final TAG:Ljava/lang/String; = "CFileUtil"


# direct methods
.method public constructor <init>()V
    .registers 1

    .prologue
    .line 10
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static copyFile(Ljava/io/InputStream;Ljava/io/File;)Z
    .registers 7

    .prologue
    const/4 v0, 0x0

    .line 17
    .line 18
    if-eqz p0, :cond_b

    if-eqz p1, :cond_b

    invoke-virtual {p1}, Ljava/io/File;->isDirectory()Z

    move-result v1

    if-eqz v1, :cond_c

    .line 46
    :cond_b
    :goto_b
    return v0

    .line 21
    :cond_c
    const/4 v1, 0x0

    .line 23
    :try_start_d
    invoke-virtual {p1}, Ljava/io/File;->exists()Z

    move-result v2

    if-eqz v2, :cond_16

    .line 24
    invoke-virtual {p1}, Ljava/io/File;->delete()Z

    .line 26
    :cond_16
    invoke-virtual {p1}, Ljava/io/File;->exists()Z

    move-result v2

    if-nez v2, :cond_1f

    .line 27
    invoke-virtual {p1}, Ljava/io/File;->createNewFile()Z

    .line 29
    :cond_1f
    new-instance v2, Ljava/io/FileOutputStream;

    invoke-direct {v2, p1}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V
    :try_end_24
    .catch Ljava/lang/Exception; {:try_start_d .. :try_end_24} :catch_55
    .catchall {:try_start_d .. :try_end_24} :catchall_49

    .line 30
    const/16 v1, 0x2000

    :try_start_26
    new-array v1, v1, [B

    .line 32
    :goto_28
    invoke-virtual {p0, v1}, Ljava/io/InputStream;->read([B)I

    move-result v3

    if-lez v3, :cond_3d

    .line 33
    const/4 v4, 0x0

    invoke-virtual {v2, v1, v4, v3}, Ljava/io/FileOutputStream;->write([BII)V
    :try_end_32
    .catch Ljava/lang/Exception; {:try_start_26 .. :try_end_32} :catch_33
    .catchall {:try_start_26 .. :try_end_32} :catchall_52

    goto :goto_28

    .line 37
    :catch_33
    move-exception v1

    move-object v1, v2

    .line 39
    :goto_35
    if-eqz v1, :cond_b

    .line 41
    :try_start_37
    invoke-virtual {v1}, Ljava/io/FileOutputStream;->close()V
    :try_end_3a
    .catch Ljava/io/IOException; {:try_start_37 .. :try_end_3a} :catch_3b

    goto :goto_b

    .line 42
    :catch_3b
    move-exception v1

    goto :goto_b

    .line 35
    :cond_3d
    :try_start_3d
    invoke-virtual {v2}, Ljava/io/FileOutputStream;->flush()V
    :try_end_40
    .catch Ljava/lang/Exception; {:try_start_3d .. :try_end_40} :catch_33
    .catchall {:try_start_3d .. :try_end_40} :catchall_52

    .line 36
    const/4 v0, 0x1

    .line 39
    if-eqz v2, :cond_b

    .line 41
    :try_start_43
    invoke-virtual {v2}, Ljava/io/FileOutputStream;->close()V
    :try_end_46
    .catch Ljava/io/IOException; {:try_start_43 .. :try_end_46} :catch_47

    goto :goto_b

    .line 42
    :catch_47
    move-exception v1

    goto :goto_b

    .line 39
    :catchall_49
    move-exception v0

    :goto_4a
    if-eqz v1, :cond_4f

    .line 41
    :try_start_4c
    invoke-virtual {v1}, Ljava/io/FileOutputStream;->close()V
    :try_end_4f
    .catch Ljava/io/IOException; {:try_start_4c .. :try_end_4f} :catch_50

    .line 43
    :cond_4f
    :goto_4f
    throw v0

    .line 42
    :catch_50
    move-exception v1

    goto :goto_4f

    .line 39
    :catchall_52
    move-exception v0

    move-object v1, v2

    goto :goto_4a

    .line 37
    :catch_55
    move-exception v2

    goto :goto_35
.end method

.method public static createDir(Ljava/lang/String;)Z
    .registers 4

    .prologue
    .line 64
    const/4 v0, 0x1

    .line 65
    new-instance v1, Ljava/io/File;

    invoke-direct {v1, p0}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 66
    invoke-virtual {v1}, Ljava/io/File;->exists()Z

    move-result v2

    if-nez v2, :cond_10

    .line 67
    invoke-virtual {v1}, Ljava/io/File;->mkdirs()Z

    move-result v0

    .line 69
    :cond_10
    return v0
.end method

.method public static getNameFromPath(Ljava/lang/String;)Ljava/lang/String;
    .registers 4

    .prologue
    .line 53
    invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_9

    const-string v0, ""

    .line 60
    :cond_8
    :goto_8
    return-object v0

    .line 55
    :cond_9
    const-string v0, ""

    .line 56
    const/16 v1, 0x2f

    invoke-virtual {p0, v1}, Ljava/lang/String;->lastIndexOf(I)I

    move-result v1

    add-int/lit8 v1, v1, 0x1

    .line 57
    if-lez v1, :cond_8

    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v2

    add-int/lit8 v2, v2, -0x1

    if-ge v1, v2, :cond_8

    .line 58
    invoke-virtual {p0, v1}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v0

    goto :goto_8
.end method