alexandroid/decompiled/jadx/sources/okio/InflaterSource.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

134 lines
6.3 KiB
Java

package okio;
import androidx.compose.animation.core.ArcMode$$ExternalSyntheticOutline0;
import java.io.IOException;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
import kotlin.Metadata;
import kotlin.jvm.internal.SourceDebugExtension;
import org.jetbrains.annotations.NotNull;
import rx.Single$$ExternalSyntheticBUOutline0;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@Metadata(d1 = {"\u0000@\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0017\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0001\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005B\u0017\b\u0000\u0012\u0006\u0010\u0002\u001a\u00020\u0006\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0007J\b\u0010\f\u001a\u00020\rH\u0016J\u0018\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u000fH\u0016J\u0016\u0010\u0013\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u000fJ\u0006\u0010\u0014\u001a\u00020\u000bJ\b\u0010\u0015\u001a\u00020\rH\u0002J\b\u0010\u0016\u001a\u00020\u0017H\u0016R\u000e\u0010\b\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0018"}, d2 = {"Lokio/InflaterSource;", "Lokio/Source;", "source", "inflater", "Ljava/util/zip/Inflater;", "(Lokio/Source;Ljava/util/zip/Inflater;)V", "Lokio/BufferedSource;", "(Lokio/BufferedSource;Ljava/util/zip/Inflater;)V", "bufferBytesHeldByInflater", "", "closed", "", "close", "", "read", "", "sink", "Lokio/Buffer;", "byteCount", "readOrInflate", "refill", "releaseBytesAfterInflate", "timeout", "Lokio/Timeout;", "okio"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nInflaterSource.kt\nKotlin\n*S Kotlin\n*F\n+ 1 InflaterSource.kt\nokio/InflaterSource\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 Util.kt\nokio/-SegmentedByteString\n*L\n1#1,147:1\n1#2:148\n86#3:149\n*S KotlinDebug\n*F\n+ 1 InflaterSource.kt\nokio/InflaterSource\n*L\n73#1:149\n*E\n"})
/* loaded from: classes10.dex */
public final class InflaterSource implements Source {
private int bufferBytesHeldByInflater;
private boolean closed;
@NotNull
private final Inflater inflater;
@NotNull
private final BufferedSource source;
public InflaterSource(@NotNull BufferedSource bufferedSource, @NotNull Inflater inflater) {
bufferedSource.getClass();
inflater.getClass();
this.source = bufferedSource;
this.inflater = inflater;
}
private final void releaseBytesAfterInflate() {
int i = this.bufferBytesHeldByInflater;
if (i == 0) {
return;
}
int remaining = i - this.inflater.getRemaining();
this.bufferBytesHeldByInflater -= remaining;
this.source.skip(remaining);
}
@Override // okio.Source, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
if (this.closed) {
return;
}
this.inflater.end();
this.closed = true;
this.source.close();
}
@Override // okio.Source
public long read(@NotNull Buffer sink, long byteCount) throws IOException {
sink.getClass();
do {
long readOrInflate = readOrInflate(sink, byteCount);
if (readOrInflate > 0) {
return readOrInflate;
}
if (this.inflater.finished() || this.inflater.needsDictionary()) {
return -1L;
}
} while (!this.source.exhausted());
Buffer$$ExternalSyntheticBUOutline0.m$3("source exhausted prematurely");
return 0L;
}
public final long readOrInflate(@NotNull Buffer sink, long byteCount) throws IOException {
sink.getClass();
if (byteCount < 0) {
Path$$ExternalSyntheticBUOutline0.m((Object) ArcMode$$ExternalSyntheticOutline0.m(byteCount, "byteCount < 0: "));
return 0L;
}
if (this.closed) {
Single$$ExternalSyntheticBUOutline0.m$2("closed");
return 0L;
}
if (byteCount == 0) {
return 0L;
}
try {
Segment writableSegment$okio = sink.writableSegment$okio(1);
int min = (int) Math.min(byteCount, 8192 - writableSegment$okio.limit);
refill();
int inflate = this.inflater.inflate(writableSegment$okio.data, writableSegment$okio.limit, min);
releaseBytesAfterInflate();
if (inflate > 0) {
writableSegment$okio.limit += inflate;
long j = inflate;
sink.setSize$okio(sink.size() + j);
return j;
}
if (writableSegment$okio.pos == writableSegment$okio.limit) {
sink.head = writableSegment$okio.pop();
SegmentPool.recycle(writableSegment$okio);
}
return 0L;
} catch (DataFormatException e) {
Buffer$$ExternalSyntheticBUOutline0.m$2(e);
return 0L;
}
}
public final boolean refill() throws IOException {
if (!this.inflater.needsInput()) {
return false;
}
if (this.source.exhausted()) {
return true;
}
Segment segment = this.source.getBuffer().head;
segment.getClass();
int i = segment.limit;
int i2 = segment.pos;
int i3 = i - i2;
this.bufferBytesHeldByInflater = i3;
this.inflater.setInput(segment.data, i2, i3);
return false;
}
@Override // okio.Source
@NotNull
public Timeout timeout() {
return this.source.timeout();
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public InflaterSource(@NotNull Source source, @NotNull Inflater inflater) {
this(Okio.buffer(source), inflater);
source.getClass();
inflater.getClass();
}
}