alexandroid/decompiled/jadx/sources/okio/NioFileSystemFileHandle.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

91 lines
4.2 KiB
Java

package okio;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import kotlin.Metadata;
import org.jetbrains.annotations.NotNull;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0007\b\u0000\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\b\u0010\u0007\u001a\u00020\bH\u0014J\b\u0010\t\u001a\u00020\bH\u0014J(\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010\u0011\u001a\u00020\u000bH\u0014J\u0010\u0010\u0012\u001a\u00020\b2\u0006\u0010\u0013\u001a\u00020\rH\u0014J\b\u0010\u0014\u001a\u00020\rH\u0014J(\u0010\u0015\u001a\u00020\b2\u0006\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010\u0011\u001a\u00020\u000bH\u0014R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0016"}, d2 = {"Lokio/NioFileSystemFileHandle;", "Lokio/FileHandle;", "readWrite", "", "fileChannel", "Ljava/nio/channels/FileChannel;", "(ZLjava/nio/channels/FileChannel;)V", "protectedClose", "", "protectedFlush", "protectedRead", "", "fileOffset", "", "array", "", "arrayOffset", "byteCount", "protectedResize", "size", "protectedSize", "protectedWrite", "okio"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes10.dex */
public final class NioFileSystemFileHandle extends FileHandle {
@NotNull
private final FileChannel fileChannel;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public NioFileSystemFileHandle(boolean z, @NotNull FileChannel fileChannel) {
super(z);
fileChannel.getClass();
this.fileChannel = fileChannel;
}
@Override // okio.FileHandle
public synchronized void protectedClose() {
this.fileChannel.close();
}
@Override // okio.FileHandle
public synchronized void protectedFlush() {
this.fileChannel.force(true);
}
@Override // okio.FileHandle
public synchronized int protectedRead(long fileOffset, @NotNull byte[] array, int arrayOffset, int byteCount) {
array.getClass();
this.fileChannel.position(fileOffset);
ByteBuffer wrap = ByteBuffer.wrap(array, arrayOffset, byteCount);
int i = 0;
while (true) {
if (i >= byteCount) {
break;
}
int read = this.fileChannel.read(wrap);
if (read != -1) {
i += read;
} else if (i == 0) {
return -1;
}
}
return i;
}
@Override // okio.FileHandle
public synchronized void protectedResize(long size) {
NioFileSystemFileHandle nioFileSystemFileHandle;
try {
try {
long size2 = size();
long j = size - size2;
if (j > 0) {
int i = (int) j;
nioFileSystemFileHandle = this;
nioFileSystemFileHandle.protectedWrite(size2, new byte[i], 0, i);
} else {
nioFileSystemFileHandle = this;
nioFileSystemFileHandle.fileChannel.truncate(size);
}
return;
} catch (Throwable th) {
th = th;
throw th;
}
} catch (Throwable th2) {
th = th2;
throw th;
}
throw th;
}
@Override // okio.FileHandle
public synchronized long protectedSize() {
return this.fileChannel.size();
}
@Override // okio.FileHandle
public synchronized void protectedWrite(long fileOffset, @NotNull byte[] array, int arrayOffset, int byteCount) {
array.getClass();
this.fileChannel.position(fileOffset);
this.fileChannel.write(ByteBuffer.wrap(array, arrayOffset, byteCount));
}
}