mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-13 09:27:16 +01:00
89 lines
4.1 KiB
Java
89 lines
4.1 KiB
Java
package okio;
|
|
|
|
import java.io.RandomAccessFile;
|
|
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/JvmFileHandle;", "Lokio/FileHandle;", "readWrite", "", "randomAccessFile", "Ljava/io/RandomAccessFile;", "(ZLjava/io/RandomAccessFile;)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 JvmFileHandle extends FileHandle {
|
|
|
|
@NotNull
|
|
private final RandomAccessFile randomAccessFile;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
public JvmFileHandle(boolean z, @NotNull RandomAccessFile randomAccessFile) {
|
|
super(z);
|
|
randomAccessFile.getClass();
|
|
this.randomAccessFile = randomAccessFile;
|
|
}
|
|
|
|
@Override // okio.FileHandle
|
|
public synchronized void protectedClose() {
|
|
this.randomAccessFile.close();
|
|
}
|
|
|
|
@Override // okio.FileHandle
|
|
public synchronized void protectedFlush() {
|
|
this.randomAccessFile.getFD().sync();
|
|
}
|
|
|
|
@Override // okio.FileHandle
|
|
public synchronized int protectedRead(long fileOffset, @NotNull byte[] array, int arrayOffset, int byteCount) {
|
|
array.getClass();
|
|
this.randomAccessFile.seek(fileOffset);
|
|
int i = 0;
|
|
while (true) {
|
|
if (i >= byteCount) {
|
|
break;
|
|
}
|
|
int read = this.randomAccessFile.read(array, arrayOffset, byteCount - i);
|
|
if (read != -1) {
|
|
i += read;
|
|
} else if (i == 0) {
|
|
return -1;
|
|
}
|
|
}
|
|
return i;
|
|
}
|
|
|
|
@Override // okio.FileHandle
|
|
public synchronized void protectedResize(long size) {
|
|
JvmFileHandle jvmFileHandle;
|
|
try {
|
|
try {
|
|
long size2 = size();
|
|
long j = size - size2;
|
|
if (j > 0) {
|
|
int i = (int) j;
|
|
jvmFileHandle = this;
|
|
jvmFileHandle.protectedWrite(size2, new byte[i], 0, i);
|
|
} else {
|
|
jvmFileHandle = this;
|
|
jvmFileHandle.randomAccessFile.setLength(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.randomAccessFile.length();
|
|
}
|
|
|
|
@Override // okio.FileHandle
|
|
public synchronized void protectedWrite(long fileOffset, @NotNull byte[] array, int arrayOffset, int byteCount) {
|
|
array.getClass();
|
|
this.randomAccessFile.seek(fileOffset);
|
|
this.randomAccessFile.write(array, arrayOffset, byteCount);
|
|
}
|
|
}
|