mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-13 01:17:17 +01:00
600 lines
28 KiB
Java
600 lines
28 KiB
Java
package okio;
|
|
|
|
import androidx.compose.animation.core.ArcMode$$ExternalSyntheticOutline0;
|
|
import com.amazon.alexa.presence.service.PresenceJobService;
|
|
import java.io.Closeable;
|
|
import java.io.IOException;
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
import kotlin.Metadata;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
import org.aspectj.lang.JoinPoint;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import rx.Single$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(d1 = {"\u0000X\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0012\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\b\b&\u0018\u00002\u00060\u0001j\u0002`\u0002:\u0002-.B\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\u0006\u0010\u0010\u001a\u00020\u0011J\u0006\u0010\u0012\u001a\u00020\u0013J\u0006\u0010\u0014\u001a\u00020\u0013J\u000e\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u0011J\u000e\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0018\u001a\u00020\u0019J\b\u0010\u001a\u001a\u00020\u0013H$J\b\u0010\u001b\u001a\u00020\u0013H$J(\u0010\u001c\u001a\u00020\r2\u0006\u0010\u001d\u001a\u00020\u00162\u0006\u0010\u001e\u001a\u00020\u001f2\u0006\u0010 \u001a\u00020\r2\u0006\u0010!\u001a\u00020\rH$J\u0010\u0010\"\u001a\u00020\u00132\u0006\u0010#\u001a\u00020\u0016H$J\b\u0010$\u001a\u00020\u0016H$J(\u0010%\u001a\u00020\u00132\u0006\u0010\u001d\u001a\u00020\u00162\u0006\u0010\u001e\u001a\u00020\u001f2\u0006\u0010 \u001a\u00020\r2\u0006\u0010!\u001a\u00020\rH$J&\u0010&\u001a\u00020\r2\u0006\u0010\u001d\u001a\u00020\u00162\u0006\u0010\u001e\u001a\u00020\u001f2\u0006\u0010 \u001a\u00020\r2\u0006\u0010!\u001a\u00020\rJ\u001e\u0010&\u001a\u00020\u00162\u0006\u0010\u001d\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020'2\u0006\u0010!\u001a\u00020\u0016J \u0010(\u001a\u00020\u00162\u0006\u0010\u001d\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020'2\u0006\u0010!\u001a\u00020\u0016H\u0002J\u0016\u0010)\u001a\u00020\u00132\u0006\u0010\u0017\u001a\u00020\u00112\u0006\u0010\u0015\u001a\u00020\u0016J\u0016\u0010)\u001a\u00020\u00132\u0006\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u0015\u001a\u00020\u0016J\u000e\u0010*\u001a\u00020\u00132\u0006\u0010#\u001a\u00020\u0016J\u0010\u0010\u0017\u001a\u00020\u00112\b\b\u0002\u0010\u001d\u001a\u00020\u0016J\u0006\u0010#\u001a\u00020\u0016J\u0010\u0010\u0018\u001a\u00020\u00192\b\b\u0002\u0010\u001d\u001a\u00020\u0016J&\u0010+\u001a\u00020\u00132\u0006\u0010\u001d\u001a\u00020\u00162\u0006\u0010\u001e\u001a\u00020\u001f2\u0006\u0010 \u001a\u00020\r2\u0006\u0010!\u001a\u00020\rJ\u001e\u0010+\u001a\u00020\u00132\u0006\u0010\u001d\u001a\u00020\u00162\u0006\u0010\u0018\u001a\u00020'2\u0006\u0010!\u001a\u00020\u0016J \u0010,\u001a\u00020\u00132\u0006\u0010\u001d\u001a\u00020\u00162\u0006\u0010\u0018\u001a\u00020'2\u0006\u0010!\u001a\u00020\u0016H\u0002R\u000e\u0010\u0006\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u0015\u0010\u0007\u001a\u00060\bj\u0002`\t¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000bR\u000e\u0010\f\u001a\u00020\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\u000f¨\u0006/"}, d2 = {"Lokio/FileHandle;", "Ljava/io/Closeable;", "Lokio/Closeable;", "readWrite", "", "(Z)V", "closed", JoinPoint.SYNCHRONIZATION_LOCK, "Ljava/util/concurrent/locks/ReentrantLock;", "Lokio/Lock;", "getLock", "()Ljava/util/concurrent/locks/ReentrantLock;", "openStreamCount", "", "getReadWrite", "()Z", "appendingSink", "Lokio/Sink;", "close", "", PresenceJobService.ACTION_REFRESH_FLUSH_KEY, "position", "", "sink", "source", "Lokio/Source;", "protectedClose", "protectedFlush", "protectedRead", "fileOffset", "array", "", "arrayOffset", "byteCount", "protectedResize", "size", "protectedSize", "protectedWrite", "read", "Lokio/Buffer;", "readNoCloseCheck", "reposition", "resize", "write", "writeNoCloseCheck", "FileHandleSink", "FileHandleSource", "okio"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
|
@SourceDebugExtension({"SMAP\nFileHandle.kt\nKotlin\n*S Kotlin\n*F\n+ 1 FileHandle.kt\nokio/FileHandle\n+ 2 -JvmPlatform.kt\nokio/_JvmPlatformKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 4 RealBufferedSource.kt\nokio/RealBufferedSource\n+ 5 RealBufferedSink.kt\nokio/RealBufferedSink\n+ 6 Util.kt\nokio/-SegmentedByteString\n*L\n1#1,444:1\n33#2:445\n33#2:447\n33#2:448\n33#2:449\n33#2:450\n33#2:451\n33#2:452\n33#2:453\n33#2:457\n33#2:459\n1#3:446\n62#4:454\n62#4:455\n62#4:456\n51#5:458\n86#6:460\n86#6:461\n*S KotlinDebug\n*F\n+ 1 FileHandle.kt\nokio/FileHandle\n*L\n69#1:445\n81#1:447\n92#1:448\n105#1:449\n119#1:450\n129#1:451\n139#1:452\n151#1:453\n221#1:457\n287#1:459\n169#1:454\n195#1:455\n202#1:456\n248#1:458\n345#1:460\n374#1:461\n*E\n"})
|
|
/* loaded from: classes10.dex */
|
|
public abstract class FileHandle implements Closeable {
|
|
private boolean closed;
|
|
|
|
@NotNull
|
|
private final ReentrantLock lock = _JvmPlatformKt.newLock();
|
|
private int openStreamCount;
|
|
private final boolean readWrite;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u000b\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0002\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\u0013\u001a\u00020\u0014H\u0016J\b\u0010\u0015\u001a\u00020\u0014H\u0016J\b\u0010\u0016\u001a\u00020\u0017H\u0016J\u0018\u0010\u0018\u001a\u00020\u00142\u0006\u0010\u0019\u001a\u00020\u001a2\u0006\u0010\u001b\u001a\u00020\u0005H\u0016R\u001a\u0010\u0007\u001a\u00020\bX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\t\u0010\n\"\u0004\b\u000b\u0010\fR\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u000eR\u001a\u0010\u0004\u001a\u00020\u0005X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000f\u0010\u0010\"\u0004\b\u0011\u0010\u0012¨\u0006\u001c"}, d2 = {"Lokio/FileHandle$FileHandleSink;", "Lokio/Sink;", "fileHandle", "Lokio/FileHandle;", "position", "", "(Lokio/FileHandle;J)V", "closed", "", "getClosed", "()Z", "setClosed", "(Z)V", "getFileHandle", "()Lokio/FileHandle;", "getPosition", "()J", "setPosition", "(J)V", "close", "", PresenceJobService.ACTION_REFRESH_FLUSH_KEY, "timeout", "Lokio/Timeout;", "write", "source", "Lokio/Buffer;", "byteCount", "okio"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
|
@SourceDebugExtension({"SMAP\nFileHandle.kt\nKotlin\n*S Kotlin\n*F\n+ 1 FileHandle.kt\nokio/FileHandle$FileHandleSink\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 -JvmPlatform.kt\nokio/_JvmPlatformKt\n*L\n1#1,444:1\n1#2:445\n33#3:446\n*S KotlinDebug\n*F\n+ 1 FileHandle.kt\nokio/FileHandle$FileHandleSink\n*L\n410#1:446\n*E\n"})
|
|
public static final class FileHandleSink implements Sink {
|
|
private boolean closed;
|
|
|
|
@NotNull
|
|
private final FileHandle fileHandle;
|
|
private long position;
|
|
|
|
public FileHandleSink(@NotNull FileHandle fileHandle, long j) {
|
|
fileHandle.getClass();
|
|
this.fileHandle = fileHandle;
|
|
this.position = j;
|
|
}
|
|
|
|
@Override // okio.Sink, java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() {
|
|
if (this.closed) {
|
|
return;
|
|
}
|
|
this.closed = true;
|
|
ReentrantLock lock = this.fileHandle.getLock();
|
|
lock.lock();
|
|
try {
|
|
FileHandle fileHandle = this.fileHandle;
|
|
fileHandle.openStreamCount--;
|
|
if (this.fileHandle.openStreamCount == 0 && this.fileHandle.closed) {
|
|
Unit unit = Unit.INSTANCE;
|
|
lock.unlock();
|
|
this.fileHandle.protectedClose();
|
|
}
|
|
} finally {
|
|
lock.unlock();
|
|
}
|
|
}
|
|
|
|
@Override // okio.Sink, java.io.Flushable
|
|
public void flush() {
|
|
if (this.closed) {
|
|
Single$$ExternalSyntheticBUOutline0.m$2("closed");
|
|
} else {
|
|
this.fileHandle.protectedFlush();
|
|
}
|
|
}
|
|
|
|
public final boolean getClosed() {
|
|
return this.closed;
|
|
}
|
|
|
|
@NotNull
|
|
public final FileHandle getFileHandle() {
|
|
return this.fileHandle;
|
|
}
|
|
|
|
public final long getPosition() {
|
|
return this.position;
|
|
}
|
|
|
|
public final void setClosed(boolean z) {
|
|
this.closed = z;
|
|
}
|
|
|
|
public final void setPosition(long j) {
|
|
this.position = j;
|
|
}
|
|
|
|
@Override // okio.Sink
|
|
@NotNull
|
|
public Timeout timeout() {
|
|
return Timeout.NONE;
|
|
}
|
|
|
|
@Override // okio.Sink
|
|
public void write(@NotNull Buffer source, long byteCount) {
|
|
source.getClass();
|
|
if (this.closed) {
|
|
Single$$ExternalSyntheticBUOutline0.m$2("closed");
|
|
} else {
|
|
this.fileHandle.writeNoCloseCheck(this.position, source, byteCount);
|
|
this.position += byteCount;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u000b\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0002\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\u0013\u001a\u00020\u0014H\u0016J\u0018\u0010\u0015\u001a\u00020\u00052\u0006\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00020\u0005H\u0016J\b\u0010\u0019\u001a\u00020\u001aH\u0016R\u001a\u0010\u0007\u001a\u00020\bX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\t\u0010\n\"\u0004\b\u000b\u0010\fR\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u000eR\u001a\u0010\u0004\u001a\u00020\u0005X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000f\u0010\u0010\"\u0004\b\u0011\u0010\u0012¨\u0006\u001b"}, d2 = {"Lokio/FileHandle$FileHandleSource;", "Lokio/Source;", "fileHandle", "Lokio/FileHandle;", "position", "", "(Lokio/FileHandle;J)V", "closed", "", "getClosed", "()Z", "setClosed", "(Z)V", "getFileHandle", "()Lokio/FileHandle;", "getPosition", "()J", "setPosition", "(J)V", "close", "", "read", "sink", "Lokio/Buffer;", "byteCount", "timeout", "Lokio/Timeout;", "okio"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
|
@SourceDebugExtension({"SMAP\nFileHandle.kt\nKotlin\n*S Kotlin\n*F\n+ 1 FileHandle.kt\nokio/FileHandle$FileHandleSource\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 -JvmPlatform.kt\nokio/_JvmPlatformKt\n*L\n1#1,444:1\n1#2:445\n33#3:446\n*S KotlinDebug\n*F\n+ 1 FileHandle.kt\nokio/FileHandle$FileHandleSource\n*L\n436#1:446\n*E\n"})
|
|
public static final class FileHandleSource implements Source {
|
|
private boolean closed;
|
|
|
|
@NotNull
|
|
private final FileHandle fileHandle;
|
|
private long position;
|
|
|
|
public FileHandleSource(@NotNull FileHandle fileHandle, long j) {
|
|
fileHandle.getClass();
|
|
this.fileHandle = fileHandle;
|
|
this.position = j;
|
|
}
|
|
|
|
@Override // okio.Source, java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() {
|
|
if (this.closed) {
|
|
return;
|
|
}
|
|
this.closed = true;
|
|
ReentrantLock lock = this.fileHandle.getLock();
|
|
lock.lock();
|
|
try {
|
|
FileHandle fileHandle = this.fileHandle;
|
|
fileHandle.openStreamCount--;
|
|
if (this.fileHandle.openStreamCount == 0 && this.fileHandle.closed) {
|
|
Unit unit = Unit.INSTANCE;
|
|
lock.unlock();
|
|
this.fileHandle.protectedClose();
|
|
}
|
|
} finally {
|
|
lock.unlock();
|
|
}
|
|
}
|
|
|
|
public final boolean getClosed() {
|
|
return this.closed;
|
|
}
|
|
|
|
@NotNull
|
|
public final FileHandle getFileHandle() {
|
|
return this.fileHandle;
|
|
}
|
|
|
|
public final long getPosition() {
|
|
return this.position;
|
|
}
|
|
|
|
@Override // okio.Source
|
|
public long read(@NotNull Buffer sink, long byteCount) {
|
|
sink.getClass();
|
|
if (this.closed) {
|
|
Single$$ExternalSyntheticBUOutline0.m$2("closed");
|
|
return 0L;
|
|
}
|
|
long readNoCloseCheck = this.fileHandle.readNoCloseCheck(this.position, sink, byteCount);
|
|
if (readNoCloseCheck != -1) {
|
|
this.position += readNoCloseCheck;
|
|
}
|
|
return readNoCloseCheck;
|
|
}
|
|
|
|
public final void setClosed(boolean z) {
|
|
this.closed = z;
|
|
}
|
|
|
|
public final void setPosition(long j) {
|
|
this.position = j;
|
|
}
|
|
|
|
@Override // okio.Source
|
|
@NotNull
|
|
public Timeout timeout() {
|
|
return Timeout.NONE;
|
|
}
|
|
}
|
|
|
|
public FileHandle(boolean z) {
|
|
this.readWrite = z;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final long readNoCloseCheck(long fileOffset, Buffer sink, long byteCount) {
|
|
if (byteCount < 0) {
|
|
Path$$ExternalSyntheticBUOutline0.m((Object) ArcMode$$ExternalSyntheticOutline0.m(byteCount, "byteCount < 0: "));
|
|
return 0L;
|
|
}
|
|
long j = byteCount + fileOffset;
|
|
long j2 = fileOffset;
|
|
while (true) {
|
|
if (j2 >= j) {
|
|
break;
|
|
}
|
|
Segment writableSegment$okio = sink.writableSegment$okio(1);
|
|
int protectedRead = protectedRead(j2, writableSegment$okio.data, writableSegment$okio.limit, (int) Math.min(j - j2, 8192 - r7));
|
|
if (protectedRead == -1) {
|
|
if (writableSegment$okio.pos == writableSegment$okio.limit) {
|
|
sink.head = writableSegment$okio.pop();
|
|
SegmentPool.recycle(writableSegment$okio);
|
|
}
|
|
if (fileOffset == j2) {
|
|
return -1L;
|
|
}
|
|
} else {
|
|
writableSegment$okio.limit += protectedRead;
|
|
long j3 = protectedRead;
|
|
j2 += j3;
|
|
sink.setSize$okio(sink.size() + j3);
|
|
}
|
|
}
|
|
return j2 - fileOffset;
|
|
}
|
|
|
|
public static /* synthetic */ Sink sink$default(FileHandle fileHandle, long j, int i, Object obj) throws IOException {
|
|
if (obj != null) {
|
|
Buffer$$ExternalSyntheticBUOutline0.m$1("Super calls with default arguments not supported in this target, function: sink");
|
|
return null;
|
|
}
|
|
if ((i & 1) != 0) {
|
|
j = 0;
|
|
}
|
|
return fileHandle.sink(j);
|
|
}
|
|
|
|
public static /* synthetic */ Source source$default(FileHandle fileHandle, long j, int i, Object obj) throws IOException {
|
|
if (obj != null) {
|
|
Buffer$$ExternalSyntheticBUOutline0.m$1("Super calls with default arguments not supported in this target, function: source");
|
|
return null;
|
|
}
|
|
if ((i & 1) != 0) {
|
|
j = 0;
|
|
}
|
|
return fileHandle.source(j);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final void writeNoCloseCheck(long fileOffset, Buffer source, long byteCount) {
|
|
SegmentedByteString.checkOffsetAndCount(source.size(), 0L, byteCount);
|
|
long j = fileOffset + byteCount;
|
|
long j2 = fileOffset;
|
|
while (j2 < j) {
|
|
Segment segment = source.head;
|
|
segment.getClass();
|
|
int min = (int) Math.min(j - j2, segment.limit - segment.pos);
|
|
FileHandle fileHandle = this;
|
|
fileHandle.protectedWrite(j2, segment.data, segment.pos, min);
|
|
segment.pos += min;
|
|
long j3 = min;
|
|
j2 += j3;
|
|
source.setSize$okio(source.size() - j3);
|
|
if (segment.pos == segment.limit) {
|
|
source.head = segment.pop();
|
|
SegmentPool.recycle(segment);
|
|
}
|
|
this = fileHandle;
|
|
}
|
|
}
|
|
|
|
@NotNull
|
|
public final Sink appendingSink() throws IOException {
|
|
return sink(size());
|
|
}
|
|
|
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
|
public final void close() throws IOException {
|
|
ReentrantLock reentrantLock = this.lock;
|
|
reentrantLock.lock();
|
|
try {
|
|
if (this.closed) {
|
|
return;
|
|
}
|
|
this.closed = true;
|
|
if (this.openStreamCount != 0) {
|
|
return;
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
reentrantLock.unlock();
|
|
protectedClose();
|
|
} finally {
|
|
reentrantLock.unlock();
|
|
}
|
|
}
|
|
|
|
public final void flush() throws IOException {
|
|
if (!this.readWrite) {
|
|
Single$$ExternalSyntheticBUOutline0.m$2("file handle is read-only");
|
|
return;
|
|
}
|
|
ReentrantLock reentrantLock = this.lock;
|
|
reentrantLock.lock();
|
|
try {
|
|
if (this.closed) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
reentrantLock.unlock();
|
|
protectedFlush();
|
|
} catch (Throwable th) {
|
|
reentrantLock.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
@NotNull
|
|
public final ReentrantLock getLock() {
|
|
return this.lock;
|
|
}
|
|
|
|
public final boolean getReadWrite() {
|
|
return this.readWrite;
|
|
}
|
|
|
|
public final long position(@NotNull Source source) throws IOException {
|
|
long j;
|
|
source.getClass();
|
|
if (source instanceof RealBufferedSource) {
|
|
RealBufferedSource realBufferedSource = (RealBufferedSource) source;
|
|
j = realBufferedSource.bufferField.size();
|
|
source = realBufferedSource.source;
|
|
} else {
|
|
j = 0;
|
|
}
|
|
if (!(source instanceof FileHandleSource) || ((FileHandleSource) source).getFileHandle() != this) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3("source was not created by this FileHandle");
|
|
return 0L;
|
|
}
|
|
FileHandleSource fileHandleSource = (FileHandleSource) source;
|
|
if (!fileHandleSource.getClosed()) {
|
|
return fileHandleSource.getPosition() - j;
|
|
}
|
|
Single$$ExternalSyntheticBUOutline0.m$2("closed");
|
|
return 0L;
|
|
}
|
|
|
|
public abstract void protectedClose() throws IOException;
|
|
|
|
public abstract void protectedFlush() throws IOException;
|
|
|
|
public abstract int protectedRead(long fileOffset, @NotNull byte[] array, int arrayOffset, int byteCount) throws IOException;
|
|
|
|
public abstract void protectedResize(long size) throws IOException;
|
|
|
|
public abstract long protectedSize() throws IOException;
|
|
|
|
public abstract void protectedWrite(long fileOffset, @NotNull byte[] array, int arrayOffset, int byteCount) throws IOException;
|
|
|
|
public final int read(long fileOffset, @NotNull byte[] array, int arrayOffset, int byteCount) throws IOException {
|
|
array.getClass();
|
|
ReentrantLock reentrantLock = this.lock;
|
|
reentrantLock.lock();
|
|
try {
|
|
if (this.closed) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
reentrantLock.unlock();
|
|
return protectedRead(fileOffset, array, arrayOffset, byteCount);
|
|
} catch (Throwable th) {
|
|
reentrantLock.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final void reposition(@NotNull Source source, long position) throws IOException {
|
|
source.getClass();
|
|
if (!(source instanceof RealBufferedSource)) {
|
|
if (!(source instanceof FileHandleSource) || ((FileHandleSource) source).getFileHandle() != this) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3("source was not created by this FileHandle");
|
|
return;
|
|
}
|
|
FileHandleSource fileHandleSource = (FileHandleSource) source;
|
|
if (fileHandleSource.getClosed()) {
|
|
Single$$ExternalSyntheticBUOutline0.m$2("closed");
|
|
return;
|
|
} else {
|
|
fileHandleSource.setPosition(position);
|
|
return;
|
|
}
|
|
}
|
|
RealBufferedSource realBufferedSource = (RealBufferedSource) source;
|
|
Source source2 = realBufferedSource.source;
|
|
if (!(source2 instanceof FileHandleSource) || ((FileHandleSource) source2).getFileHandle() != this) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3("source was not created by this FileHandle");
|
|
return;
|
|
}
|
|
FileHandleSource fileHandleSource2 = (FileHandleSource) source2;
|
|
if (fileHandleSource2.getClosed()) {
|
|
Single$$ExternalSyntheticBUOutline0.m$2("closed");
|
|
return;
|
|
}
|
|
long size = realBufferedSource.bufferField.size();
|
|
long position2 = position - (fileHandleSource2.getPosition() - size);
|
|
if (0 <= position2 && position2 < size) {
|
|
realBufferedSource.skip(position2);
|
|
} else {
|
|
realBufferedSource.bufferField.clear();
|
|
fileHandleSource2.setPosition(position);
|
|
}
|
|
}
|
|
|
|
public final void resize(long size) throws IOException {
|
|
if (!this.readWrite) {
|
|
Single$$ExternalSyntheticBUOutline0.m$2("file handle is read-only");
|
|
return;
|
|
}
|
|
ReentrantLock reentrantLock = this.lock;
|
|
reentrantLock.lock();
|
|
try {
|
|
if (this.closed) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
reentrantLock.unlock();
|
|
protectedResize(size);
|
|
} catch (Throwable th) {
|
|
reentrantLock.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
@NotNull
|
|
public final Sink sink(long fileOffset) throws IOException {
|
|
if (!this.readWrite) {
|
|
Single$$ExternalSyntheticBUOutline0.m$2("file handle is read-only");
|
|
return null;
|
|
}
|
|
ReentrantLock reentrantLock = this.lock;
|
|
reentrantLock.lock();
|
|
try {
|
|
if (this.closed) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
this.openStreamCount++;
|
|
reentrantLock.unlock();
|
|
return new FileHandleSink(this, fileOffset);
|
|
} catch (Throwable th) {
|
|
reentrantLock.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final long size() throws IOException {
|
|
ReentrantLock reentrantLock = this.lock;
|
|
reentrantLock.lock();
|
|
try {
|
|
if (this.closed) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
reentrantLock.unlock();
|
|
return protectedSize();
|
|
} catch (Throwable th) {
|
|
reentrantLock.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
@NotNull
|
|
public final Source source(long fileOffset) throws IOException {
|
|
ReentrantLock reentrantLock = this.lock;
|
|
reentrantLock.lock();
|
|
try {
|
|
if (this.closed) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
this.openStreamCount++;
|
|
reentrantLock.unlock();
|
|
return new FileHandleSource(this, fileOffset);
|
|
} catch (Throwable th) {
|
|
reentrantLock.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final void write(long fileOffset, @NotNull byte[] array, int arrayOffset, int byteCount) {
|
|
array.getClass();
|
|
if (!this.readWrite) {
|
|
Single$$ExternalSyntheticBUOutline0.m$2("file handle is read-only");
|
|
return;
|
|
}
|
|
ReentrantLock reentrantLock = this.lock;
|
|
reentrantLock.lock();
|
|
try {
|
|
if (this.closed) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
reentrantLock.unlock();
|
|
protectedWrite(fileOffset, array, arrayOffset, byteCount);
|
|
} catch (Throwable th) {
|
|
reentrantLock.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final long read(long fileOffset, @NotNull Buffer sink, long byteCount) throws IOException {
|
|
sink.getClass();
|
|
ReentrantLock reentrantLock = this.lock;
|
|
reentrantLock.lock();
|
|
try {
|
|
if (!this.closed) {
|
|
Unit unit = Unit.INSTANCE;
|
|
reentrantLock.unlock();
|
|
return readNoCloseCheck(fileOffset, sink, byteCount);
|
|
}
|
|
throw new IllegalStateException("closed");
|
|
} catch (Throwable th) {
|
|
reentrantLock.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final void write(long fileOffset, @NotNull Buffer source, long byteCount) throws IOException {
|
|
source.getClass();
|
|
if (this.readWrite) {
|
|
ReentrantLock reentrantLock = this.lock;
|
|
reentrantLock.lock();
|
|
try {
|
|
if (!this.closed) {
|
|
Unit unit = Unit.INSTANCE;
|
|
reentrantLock.unlock();
|
|
writeNoCloseCheck(fileOffset, source, byteCount);
|
|
return;
|
|
}
|
|
throw new IllegalStateException("closed");
|
|
} catch (Throwable th) {
|
|
reentrantLock.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
Single$$ExternalSyntheticBUOutline0.m$2("file handle is read-only");
|
|
}
|
|
|
|
public final long position(@NotNull Sink sink) throws IOException {
|
|
long j;
|
|
sink.getClass();
|
|
if (sink instanceof RealBufferedSink) {
|
|
RealBufferedSink realBufferedSink = (RealBufferedSink) sink;
|
|
j = realBufferedSink.bufferField.size();
|
|
sink = realBufferedSink.sink;
|
|
} else {
|
|
j = 0;
|
|
}
|
|
if ((sink instanceof FileHandleSink) && ((FileHandleSink) sink).getFileHandle() == this) {
|
|
FileHandleSink fileHandleSink = (FileHandleSink) sink;
|
|
if (!fileHandleSink.getClosed()) {
|
|
return fileHandleSink.getPosition() + j;
|
|
}
|
|
Single$$ExternalSyntheticBUOutline0.m$2("closed");
|
|
return 0L;
|
|
}
|
|
Single$$ExternalSyntheticBUOutline0.m$3("sink was not created by this FileHandle");
|
|
return 0L;
|
|
}
|
|
|
|
public final void reposition(@NotNull Sink sink, long position) throws IOException {
|
|
sink.getClass();
|
|
if (sink instanceof RealBufferedSink) {
|
|
RealBufferedSink realBufferedSink = (RealBufferedSink) sink;
|
|
Sink sink2 = realBufferedSink.sink;
|
|
if ((sink2 instanceof FileHandleSink) && ((FileHandleSink) sink2).getFileHandle() == this) {
|
|
FileHandleSink fileHandleSink = (FileHandleSink) sink2;
|
|
if (!fileHandleSink.getClosed()) {
|
|
realBufferedSink.emit();
|
|
fileHandleSink.setPosition(position);
|
|
return;
|
|
} else {
|
|
Single$$ExternalSyntheticBUOutline0.m$2("closed");
|
|
return;
|
|
}
|
|
}
|
|
Single$$ExternalSyntheticBUOutline0.m$3("sink was not created by this FileHandle");
|
|
return;
|
|
}
|
|
if ((sink instanceof FileHandleSink) && ((FileHandleSink) sink).getFileHandle() == this) {
|
|
FileHandleSink fileHandleSink2 = (FileHandleSink) sink;
|
|
if (!fileHandleSink2.getClosed()) {
|
|
fileHandleSink2.setPosition(position);
|
|
return;
|
|
} else {
|
|
Single$$ExternalSyntheticBUOutline0.m$2("closed");
|
|
return;
|
|
}
|
|
}
|
|
Single$$ExternalSyntheticBUOutline0.m$3("sink was not created by this FileHandle");
|
|
}
|
|
}
|