Util.smali
.class final Lcom/nostra13/universalimageloader/cache/disc/impl/ext/Util;
.super Ljava/lang/Object;
.source "Util.java"
# static fields
.field static final US_ASCII:Ljava/nio/charset/Charset;
.field static final UTF_8:Ljava/nio/charset/Charset;
# direct methods
.method static constructor <clinit>()V
.registers 1
const-string v0, "US-ASCII"
.line 27
invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
move-result-object v0
sput-object v0, Lcom/nostra13/universalimageloader/cache/disc/impl/ext/Util;->US_ASCII:Ljava/nio/charset/Charset;
const-string v0, "UTF-8"
.line 28
invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
move-result-object v0
sput-object v0, Lcom/nostra13/universalimageloader/cache/disc/impl/ext/Util;->UTF_8:Ljava/nio/charset/Charset;
return-void
.end method
.method private constructor <init>()V
.registers 1
.line 30
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method static closeQuietly(Ljava/io/Closeable;)V
.registers 1
if-eqz p0, :cond_8
.line 69
:try_start_2
invoke-interface {p0}, Ljava/io/Closeable;->close()V
:try_end_5
.catch Ljava/lang/RuntimeException; {:try_start_2 .. :try_end_5} :catch_6
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_5} :catch_8
goto :goto_8
:catch_6
move-exception p0
.line 71
throw p0
:catch_8
:cond_8
:goto_8
return-void
.end method
.method static deleteContents(Ljava/io/File;)V
.registers 5
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 52
invoke-virtual {p0}, Ljava/io/File;->listFiles()[Ljava/io/File;
move-result-object v0
if-eqz v0, :cond_36
.line 56
array-length p0, v0
const/4 v1, 0x0
:goto_8
if-ge v1, p0, :cond_35
aget-object v2, v0, v1
.line 57
invoke-virtual {v2}, Ljava/io/File;->isDirectory()Z
move-result v3
if-eqz v3, :cond_15
.line 58
invoke-static {v2}, Lcom/nostra13/universalimageloader/cache/disc/impl/ext/Util;->deleteContents(Ljava/io/File;)V
.line 60
:cond_15
invoke-virtual {v2}, Ljava/io/File;->delete()Z
move-result v3
if-eqz v3, :cond_1e
add-int/lit8 v1, v1, 0x1
goto :goto_8
.line 61
:cond_1e
new-instance p0, Ljava/io/IOException;
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v1, "failed to delete file: "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {p0, v0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw p0
:cond_35
return-void
.line 54
:cond_36
new-instance v0, Ljava/io/IOException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "not a readable directory: "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
invoke-direct {v0, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
goto :goto_4e
:goto_4d
throw v0
:goto_4e
goto :goto_4d
.end method
.method static readFully(Ljava/io/Reader;)Ljava/lang/String;
.registers 5
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 35
:try_start_0
new-instance v0, Ljava/io/StringWriter;
invoke-direct {v0}, Ljava/io/StringWriter;-><init>()V
const/16 v1, 0x400
new-array v1, v1, [C
.line 38
:goto_9
invoke-virtual {p0, v1}, Ljava/io/Reader;->read([C)I
move-result v2
const/4 v3, -0x1
if-eq v2, v3, :cond_15
const/4 v3, 0x0
.line 39
invoke-virtual {v0, v1, v3, v2}, Ljava/io/StringWriter;->write([CII)V
goto :goto_9
.line 41
:cond_15
invoke-virtual {v0}, Ljava/io/StringWriter;->toString()Ljava/lang/String;
move-result-object v0
:try_end_19
.catchall {:try_start_0 .. :try_end_19} :catchall_1d
.line 43
invoke-virtual {p0}, Ljava/io/Reader;->close()V
return-object v0
:catchall_1d
move-exception v0
invoke-virtual {p0}, Ljava/io/Reader;->close()V
goto :goto_23
:goto_22
throw v0
:goto_23
goto :goto_22
.end method