apkfuckery/com.discord/smali/androidx/room/util/FileUtil.smali
2020-07-08 16:44:49 +00:00

110 lines
2.6 KiB
Smali

.class public Landroidx/room/util/FileUtil;
.super Ljava/lang/Object;
.source "FileUtil.java"
# annotations
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
# direct methods
.method public constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static copy(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/channels/FileChannel;)V
.locals 9
.param p0 # Ljava/nio/channels/ReadableByteChannel;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p1 # Ljava/nio/channels/FileChannel;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroid/annotation/SuppressLint;
value = {
"LambdaLast"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
:try_start_0
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x17
const/4 v2, 0x0
if-le v0, v1, :cond_0
const-wide/16 v5, 0x0
const-wide v7, 0x7fffffffffffffffL
move-object v3, p1
move-object v4, p0
invoke-virtual/range {v3 .. v8}, Ljava/nio/channels/FileChannel;->transferFrom(Ljava/nio/channels/ReadableByteChannel;JJ)J
goto :goto_1
:cond_0
invoke-static {p0}, Ljava/nio/channels/Channels;->newInputStream(Ljava/nio/channels/ReadableByteChannel;)Ljava/io/InputStream;
move-result-object v0
invoke-static {p1}, Ljava/nio/channels/Channels;->newOutputStream(Ljava/nio/channels/WritableByteChannel;)Ljava/io/OutputStream;
move-result-object v1
const/16 v3, 0x1000
new-array v3, v3, [B
:goto_0
invoke-virtual {v0, v3}, Ljava/io/InputStream;->read([B)I
move-result v4
if-lez v4, :cond_1
invoke-virtual {v1, v3, v2, v4}, Ljava/io/OutputStream;->write([BII)V
goto :goto_0
:cond_1
:goto_1
invoke-virtual {p1, v2}, Ljava/nio/channels/FileChannel;->force(Z)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-interface {p0}, Ljava/nio/channels/ReadableByteChannel;->close()V
invoke-virtual {p1}, Ljava/nio/channels/FileChannel;->close()V
return-void
:catchall_0
move-exception v0
invoke-interface {p0}, Ljava/nio/channels/ReadableByteChannel;->close()V
invoke-virtual {p1}, Ljava/nio/channels/FileChannel;->close()V
throw v0
.end method