274 lines
5.5 KiB
Smali
274 lines
5.5 KiB
Smali
.class public Lcom/qq/e/comm/util/StringUtil;
|
|
.super Ljava/lang/Object;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static isEmpty(Ljava/lang/String;)Z
|
|
.locals 0
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
invoke-virtual {p0}, Ljava/lang/String;->trim()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/String;->length()I
|
|
|
|
move-result p0
|
|
|
|
if-nez p0, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 p0, 0x0
|
|
|
|
return p0
|
|
|
|
:cond_1
|
|
:goto_0
|
|
const/4 p0, 0x1
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static join(Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 3
|
|
|
|
new-instance v0, Ljava/lang/StringBuffer;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuffer;-><init>()V
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
array-length v2, p1
|
|
|
|
if-ge v1, v2, :cond_1
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-virtual {v0, p0}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;
|
|
|
|
:cond_0
|
|
aget-object v2, p1, v1
|
|
|
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;
|
|
|
|
add-int/lit8 v1, v1, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
invoke-virtual {v0}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static parseInteger(Ljava/lang/String;I)I
|
|
.locals 0
|
|
|
|
:try_start_0
|
|
invoke-static {p0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
|
|
|
|
move-result p0
|
|
:try_end_0
|
|
.catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return p0
|
|
|
|
:catch_0
|
|
return p1
|
|
.end method
|
|
|
|
.method public static readAll(Ljava/io/File;)Ljava/lang/String;
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p0, :cond_3
|
|
|
|
invoke-virtual {p0}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
goto :goto_5
|
|
|
|
:cond_0
|
|
:try_start_0
|
|
new-instance v1, Ljava/io/FileReader;
|
|
|
|
invoke-direct {v1, p0}, Ljava/io/FileReader;-><init>(Ljava/io/File;)V
|
|
|
|
new-instance p0, Ljava/io/BufferedReader;
|
|
|
|
invoke-direct {p0, v1}, 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
|
|
|
|
:try_start_1
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
:goto_0
|
|
invoke-virtual {p0}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
:try_end_1
|
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_1
|
|
|
|
:try_start_2
|
|
invoke-virtual {p0}, Ljava/io/BufferedReader;->close()V
|
|
:try_end_2
|
|
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0
|
|
|
|
goto :goto_1
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
const-string v1, "Exception while close bufferreader"
|
|
|
|
invoke-static {v1, p0}, Lcom/qq/e/comm/util/GDTLogger;->e(Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
:goto_1
|
|
return-object v0
|
|
|
|
:catch_1
|
|
move-exception v0
|
|
|
|
goto :goto_2
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
move-object v2, v0
|
|
|
|
move-object v0, p0
|
|
|
|
move-object p0, v2
|
|
|
|
goto :goto_3
|
|
|
|
:catch_2
|
|
move-exception p0
|
|
|
|
move-object v2, v0
|
|
|
|
move-object v0, p0
|
|
|
|
move-object p0, v2
|
|
|
|
:goto_2
|
|
:try_start_3
|
|
throw v0
|
|
:try_end_3
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_1
|
|
|
|
:catchall_1
|
|
move-exception v0
|
|
|
|
:goto_3
|
|
if-eqz p0, :cond_2
|
|
|
|
:try_start_4
|
|
invoke-virtual {p0}, Ljava/io/BufferedReader;->close()V
|
|
:try_end_4
|
|
.catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_3
|
|
|
|
goto :goto_4
|
|
|
|
:catch_3
|
|
move-exception p0
|
|
|
|
const-string v1, "Exception while close bufferreader"
|
|
|
|
invoke-static {v1, p0}, Lcom/qq/e/comm/util/GDTLogger;->e(Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
:cond_2
|
|
:goto_4
|
|
throw v0
|
|
|
|
:cond_3
|
|
:goto_5
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static writeTo(Ljava/lang/String;Ljava/io/File;)V
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
invoke-virtual {p1}, Ljava/io/File;->getParentFile()Ljava/io/File;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
invoke-virtual {v0}, Ljava/io/File;->mkdirs()Z
|
|
|
|
:cond_0
|
|
new-instance v0, Ljava/io/FileWriter;
|
|
|
|
invoke-direct {v0, p1}, Ljava/io/FileWriter;-><init>(Ljava/io/File;)V
|
|
|
|
invoke-virtual {v0, p0}, Ljava/io/FileWriter;->write(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0}, Ljava/io/FileWriter;->close()V
|
|
|
|
return-void
|
|
|
|
:cond_1
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
const-string p1, "Target File Can not be null in StringUtil.writeTo"
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p0
|
|
.end method
|