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

139 lines
6.1 KiB
Java

package okio;
import androidx.compose.animation.core.ArcMode$$ExternalSyntheticOutline0;
import com.amazon.alexa.presence.service.PresenceJobService;
import java.io.IOException;
import java.util.zip.CRC32;
import java.util.zip.Deflater;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.jvm.JvmName;
import kotlin.jvm.internal.SourceDebugExtension;
import org.jetbrains.annotations.NotNull;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@Metadata(d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0004\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0001¢\u0006\u0002\u0010\u0003J\b\u0010\u000e\u001a\u00020\u000fH\u0016J\r\u0010\b\u001a\u00020\tH\u0007¢\u0006\u0002\b\u0010J\b\u0010\u0011\u001a\u00020\u000fH\u0016J\b\u0010\u0012\u001a\u00020\u0013H\u0016J\u0018\u0010\u0014\u001a\u00020\u000f2\u0006\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u0018H\u0002J\u0018\u0010\u0019\u001a\u00020\u000f2\u0006\u0010\u001a\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u0018H\u0016J\b\u0010\u001b\u001a\u00020\u000fH\u0002R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u0013\u0010\b\u001a\u00020\t8G¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\nR\u000e\u0010\u000b\u001a\u00020\fX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\rX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001c"}, d2 = {"Lokio/GzipSink;", "Lokio/Sink;", "sink", "(Lokio/Sink;)V", "closed", "", "crc", "Ljava/util/zip/CRC32;", "deflater", "Ljava/util/zip/Deflater;", "()Ljava/util/zip/Deflater;", "deflaterSink", "Lokio/DeflaterSink;", "Lokio/RealBufferedSink;", "close", "", "-deprecated_deflater", PresenceJobService.ACTION_REFRESH_FLUSH_KEY, "timeout", "Lokio/Timeout;", "updateCrc", "buffer", "Lokio/Buffer;", "byteCount", "", "write", "source", "writeFooter", "okio"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nGzipSink.kt\nKotlin\n*S Kotlin\n*F\n+ 1 GzipSink.kt\nokio/GzipSink\n+ 2 RealBufferedSink.kt\nokio/RealBufferedSink\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 4 Util.kt\nokio/-SegmentedByteString\n*L\n1#1,153:1\n51#2:154\n1#3:155\n86#4:156\n*S KotlinDebug\n*F\n+ 1 GzipSink.kt\nokio/GzipSink\n*L\n63#1:154\n131#1:156\n*E\n"})
/* loaded from: classes10.dex */
public final class GzipSink implements Sink {
private boolean closed;
@NotNull
private final CRC32 crc;
@NotNull
private final Deflater deflater;
@NotNull
private final DeflaterSink deflaterSink;
@NotNull
private final RealBufferedSink sink;
public GzipSink(@NotNull Sink sink) {
sink.getClass();
RealBufferedSink realBufferedSink = new RealBufferedSink(sink);
this.sink = realBufferedSink;
Deflater deflater = new Deflater(-1, true);
this.deflater = deflater;
this.deflaterSink = new DeflaterSink((BufferedSink) realBufferedSink, deflater);
this.crc = new CRC32();
Buffer buffer = realBufferedSink.bufferField;
buffer.writeShort(8075);
buffer.writeByte(8);
buffer.writeByte(0);
buffer.writeInt(0);
buffer.writeByte(0);
buffer.writeByte(0);
}
private final void updateCrc(Buffer buffer, long byteCount) {
Segment segment = buffer.head;
segment.getClass();
while (byteCount > 0) {
int min = (int) Math.min(byteCount, segment.limit - segment.pos);
this.crc.update(segment.data, segment.pos, min);
byteCount -= min;
segment = segment.next;
segment.getClass();
}
}
private final void writeFooter() {
this.sink.writeIntLe((int) this.crc.getValue());
this.sink.writeIntLe((int) this.deflater.getBytesRead());
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "deflater", imports = {}))
@JvmName(name = "-deprecated_deflater")
@NotNull
/* renamed from: -deprecated_deflater, reason: not valid java name and from getter */
public final Deflater getDeflater() {
return this.deflater;
}
@Override // okio.Sink, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
if (this.closed) {
return;
}
try {
this.deflaterSink.finishDeflate$okio();
writeFooter();
th = null;
} catch (Throwable th) {
th = th;
}
try {
this.deflater.end();
} catch (Throwable th2) {
if (th == null) {
th = th2;
}
}
try {
this.sink.close();
} catch (Throwable th3) {
if (th == null) {
th = th3;
}
}
this.closed = true;
if (th != null) {
throw th;
}
}
@JvmName(name = "deflater")
@NotNull
public final Deflater deflater() {
return this.deflater;
}
@Override // okio.Sink, java.io.Flushable
public void flush() throws IOException {
this.deflaterSink.flush();
}
@Override // okio.Sink
@NotNull
public Timeout timeout() {
return this.sink.timeout();
}
@Override // okio.Sink
public void write(@NotNull Buffer source, long byteCount) throws IOException {
source.getClass();
if (byteCount < 0) {
Path$$ExternalSyntheticBUOutline0.m((Object) ArcMode$$ExternalSyntheticOutline0.m(byteCount, "byteCount < 0: "));
} else {
if (byteCount == 0) {
return;
}
updateCrc(source, byteCount);
this.deflaterSink.write(source, byteCount);
}
}
}