353 lines
8 KiB
Smali
353 lines
8 KiB
Smali
.class final Lokhttp3/internal/io/FileSystem$1;
|
|
.super Ljava/lang/Object;
|
|
.source "FileSystem.java"
|
|
|
|
# interfaces
|
|
.implements Lokhttp3/internal/io/FileSystem;
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/EnclosingClass;
|
|
value = Lokhttp3/internal/io/FileSystem;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/InnerClass;
|
|
accessFlags = 0x8
|
|
name = null
|
|
.end annotation
|
|
|
|
|
|
# direct methods
|
|
.method constructor <init>()V
|
|
.locals 0
|
|
|
|
.prologue
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public appendingSink(Ljava/io/File;)Lokio/Sink;
|
|
.locals 2
|
|
.param p1, "file" # Ljava/io/File;
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/FileNotFoundException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
:try_start_0
|
|
invoke-static {p1}, Lokio/Okio;->appendingSink(Ljava/io/File;)Lokio/Sink;
|
|
:try_end_0
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
move-result-object v1
|
|
|
|
:goto_0
|
|
return-object v1
|
|
|
|
:catch_0
|
|
move-exception v0
|
|
|
|
.local v0, "e":Ljava/io/FileNotFoundException;
|
|
invoke-virtual {p1}, Ljava/io/File;->getParentFile()Ljava/io/File;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Ljava/io/File;->mkdirs()Z
|
|
|
|
invoke-static {p1}, Lokio/Okio;->appendingSink(Ljava/io/File;)Lokio/Sink;
|
|
|
|
move-result-object v1
|
|
|
|
goto :goto_0
|
|
.end method
|
|
|
|
.method public delete(Ljava/io/File;)V
|
|
.locals 3
|
|
.param p1, "file" # Ljava/io/File;
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
invoke-virtual {p1}, Ljava/io/File;->delete()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
invoke-virtual {p1}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
new-instance v0, Ljava/io/IOException;
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "failed to delete "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public deleteContents(Ljava/io/File;)V
|
|
.locals 5
|
|
.param p1, "directory" # Ljava/io/File;
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
invoke-virtual {p1}, Ljava/io/File;->listFiles()[Ljava/io/File;
|
|
|
|
move-result-object v1
|
|
|
|
.local v1, "files":[Ljava/io/File;
|
|
if-nez v1, :cond_0
|
|
|
|
new-instance v2, Ljava/io/IOException;
|
|
|
|
new-instance v3, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v4, "not a readable directory: "
|
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-direct {v2, v3}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v2
|
|
|
|
:cond_0
|
|
array-length v3, v1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
:goto_0
|
|
if-ge v2, v3, :cond_3
|
|
|
|
aget-object v0, v1, v2
|
|
|
|
.local v0, "file":Ljava/io/File;
|
|
invoke-virtual {v0}, Ljava/io/File;->isDirectory()Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_1
|
|
|
|
invoke-virtual {p0, v0}, Lokhttp3/internal/io/FileSystem$1;->deleteContents(Ljava/io/File;)V
|
|
|
|
:cond_1
|
|
invoke-virtual {v0}, Ljava/io/File;->delete()Z
|
|
|
|
move-result v4
|
|
|
|
if-nez v4, :cond_2
|
|
|
|
new-instance v2, Ljava/io/IOException;
|
|
|
|
new-instance v3, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v4, "failed to delete "
|
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-direct {v2, v3}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v2
|
|
|
|
:cond_2
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
.end local v0 # "file":Ljava/io/File;
|
|
:cond_3
|
|
return-void
|
|
.end method
|
|
|
|
.method public exists(Ljava/io/File;)Z
|
|
.locals 1
|
|
.param p1, "file" # Ljava/io/File;
|
|
|
|
.prologue
|
|
invoke-virtual {p1}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public rename(Ljava/io/File;Ljava/io/File;)V
|
|
.locals 3
|
|
.param p1, "from" # Ljava/io/File;
|
|
.param p2, "to" # Ljava/io/File;
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
invoke-virtual {p0, p2}, Lokhttp3/internal/io/FileSystem$1;->delete(Ljava/io/File;)V
|
|
|
|
invoke-virtual {p1, p2}, Ljava/io/File;->renameTo(Ljava/io/File;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
new-instance v0, Ljava/io/IOException;
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "failed to rename "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
const-string v2, " to "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public sink(Ljava/io/File;)Lokio/Sink;
|
|
.locals 2
|
|
.param p1, "file" # Ljava/io/File;
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/FileNotFoundException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
:try_start_0
|
|
invoke-static {p1}, Lokio/Okio;->sink(Ljava/io/File;)Lokio/Sink;
|
|
:try_end_0
|
|
.catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
move-result-object v1
|
|
|
|
:goto_0
|
|
return-object v1
|
|
|
|
:catch_0
|
|
move-exception v0
|
|
|
|
.local v0, "e":Ljava/io/FileNotFoundException;
|
|
invoke-virtual {p1}, Ljava/io/File;->getParentFile()Ljava/io/File;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Ljava/io/File;->mkdirs()Z
|
|
|
|
invoke-static {p1}, Lokio/Okio;->sink(Ljava/io/File;)Lokio/Sink;
|
|
|
|
move-result-object v1
|
|
|
|
goto :goto_0
|
|
.end method
|
|
|
|
.method public size(Ljava/io/File;)J
|
|
.locals 2
|
|
.param p1, "file" # Ljava/io/File;
|
|
|
|
.prologue
|
|
invoke-virtual {p1}, Ljava/io/File;->length()J
|
|
|
|
move-result-wide v0
|
|
|
|
return-wide v0
|
|
.end method
|
|
|
|
.method public source(Ljava/io/File;)Lokio/Source;
|
|
.locals 1
|
|
.param p1, "file" # Ljava/io/File;
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/FileNotFoundException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
invoke-static {p1}, Lokio/Okio;->source(Ljava/io/File;)Lokio/Source;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|