100 lines
2.3 KiB
Smali
100 lines
2.3 KiB
Smali
.class public final Lf/g/m/g;
|
|
.super Ljava/lang/Object;
|
|
.source "FileLocker.java"
|
|
|
|
# interfaces
|
|
.implements Ljava/io/Closeable;
|
|
|
|
|
|
# instance fields
|
|
.field public final d:Ljava/io/FileOutputStream;
|
|
|
|
.field public final e:Ljava/nio/channels/FileLock;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Ljava/io/File;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
new-instance v0, Ljava/io/FileOutputStream;
|
|
|
|
invoke-direct {v0, p1}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V
|
|
|
|
iput-object v0, p0, Lf/g/m/g;->d:Ljava/io/FileOutputStream;
|
|
|
|
:try_start_0
|
|
invoke-virtual {v0}, Ljava/io/FileOutputStream;->getChannel()Ljava/nio/channels/FileChannel;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1}, Ljava/nio/channels/FileChannel;->lock()Ljava/nio/channels/FileLock;
|
|
|
|
move-result-object p1
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
iget-object v0, p0, Lf/g/m/g;->d:Ljava/io/FileOutputStream;
|
|
|
|
invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
|
|
|
|
:cond_0
|
|
iput-object p1, p0, Lf/g/m/g;->e:Ljava/nio/channels/FileLock;
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
iget-object v0, p0, Lf/g/m/g;->d:Ljava/io/FileOutputStream;
|
|
|
|
invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public close()V
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
:try_start_0
|
|
iget-object v0, p0, Lf/g/m/g;->e:Ljava/nio/channels/FileLock;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Lf/g/m/g;->e:Ljava/nio/channels/FileLock;
|
|
|
|
invoke-virtual {v0}, Ljava/nio/channels/FileLock;->release()V
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
:cond_0
|
|
iget-object v0, p0, Lf/g/m/g;->d:Ljava/io/FileOutputStream;
|
|
|
|
invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
iget-object v1, p0, Lf/g/m/g;->d:Ljava/io/FileOutputStream;
|
|
|
|
invoke-virtual {v1}, Ljava/io/FileOutputStream;->close()V
|
|
|
|
throw v0
|
|
.end method
|