Rabbit-R1/switch port/smali/smali_classes3/okio/GzipSource.smali
2024-05-21 17:08:36 -04:00

797 lines
19 KiB
Smali

.class public final Lokio/GzipSource;
.super Ljava/lang/Object;
.source "GzipSource.kt"
# interfaces
.implements Lokio/Source;
# annotations
.annotation system Ldalvik/annotation/SourceDebugExtension;
value = "SMAP\nGzipSource.kt\nKotlin\n*S Kotlin\n*F\n+ 1 GzipSource.kt\nokio/GzipSource\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 RealBufferedSource.kt\nokio/RealBufferedSource\n+ 4 GzipSource.kt\nokio/-GzipSourceExtensions\n+ 5 -Util.kt\nokio/-Util\n*L\n1#1,220:1\n1#2:221\n61#3:222\n61#3:224\n61#3:226\n61#3:227\n61#3:228\n61#3:230\n61#3:232\n202#4:223\n202#4:225\n202#4:229\n202#4:231\n78#5:233\n*E\n*S KotlinDebug\n*F\n+ 1 GzipSource.kt\nokio/GzipSource\n*L\n105#1:222\n107#1:224\n119#1:226\n120#1:227\n122#1:228\n133#1:230\n144#1:232\n106#1:223\n117#1:225\n130#1:229\n141#1:231\n187#1:233\n*E\n"
.end annotation
.annotation runtime Lkotlin/Metadata;
bv = {
0x1,
0x0,
0x3
}
d1 = {
"\u0000R\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0008\n\u0002\u0008\u0005\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0004\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0001\u00a2\u0006\u0002\u0010\u0003J \u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\u0012H\u0002J\u0008\u0010\u0014\u001a\u00020\u000eH\u0016J\u0008\u0010\u0015\u001a\u00020\u000eH\u0002J\u0008\u0010\u0016\u001a\u00020\u000eH\u0002J\u0018\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\u001a2\u0006\u0010\u001b\u001a\u00020\u0018H\u0016J\u0008\u0010\u001c\u001a\u00020\u001dH\u0016J \u0010\u001e\u001a\u00020\u000e2\u0006\u0010\u001f\u001a\u00020\u001a2\u0006\u0010 \u001a\u00020\u00182\u0006\u0010\u001b\u001a\u00020\u0018H\u0002R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0008\u001a\u00020\tX\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u000cX\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006!"
}
d2 = {
"Lokio/GzipSource;",
"Lokio/Source;",
"source",
"(Lokio/Source;)V",
"crc",
"Ljava/util/zip/CRC32;",
"inflater",
"Ljava/util/zip/Inflater;",
"inflaterSource",
"Lokio/InflaterSource;",
"section",
"",
"Lokio/RealBufferedSource;",
"checkEqual",
"",
"name",
"",
"expected",
"",
"actual",
"close",
"consumeHeader",
"consumeTrailer",
"read",
"",
"sink",
"Lokio/Buffer;",
"byteCount",
"timeout",
"Lokio/Timeout;",
"updateCrc",
"buffer",
"offset",
"okio"
}
k = 0x1
mv = {
0x1,
0x4,
0x0
}
.end annotation
# instance fields
.field private final crc:Ljava/util/zip/CRC32;
.field private final inflater:Ljava/util/zip/Inflater;
.field private final inflaterSource:Lokio/InflaterSource;
.field private section:B
.field private final source:Lokio/RealBufferedSource;
# direct methods
.method public constructor <init>(Lokio/Source;)V
.locals 2
const-string v0, "source"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 31
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 41
new-instance v0, Lokio/RealBufferedSource;
invoke-direct {v0, p1}, Lokio/RealBufferedSource;-><init>(Lokio/Source;)V
iput-object v0, p0, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 44
new-instance p1, Ljava/util/zip/Inflater;
const/4 v1, 0x1
invoke-direct {p1, v1}, Ljava/util/zip/Inflater;-><init>(Z)V
iput-object p1, p0, Lokio/GzipSource;->inflater:Ljava/util/zip/Inflater;
.line 50
new-instance v1, Lokio/InflaterSource;
check-cast v0, Lokio/BufferedSource;
invoke-direct {v1, v0, p1}, Lokio/InflaterSource;-><init>(Lokio/BufferedSource;Ljava/util/zip/Inflater;)V
iput-object v1, p0, Lokio/GzipSource;->inflaterSource:Lokio/InflaterSource;
.line 53
new-instance p1, Ljava/util/zip/CRC32;
invoke-direct {p1}, Ljava/util/zip/CRC32;-><init>()V
iput-object p1, p0, Lokio/GzipSource;->crc:Ljava/util/zip/CRC32;
return-void
.end method
.method private final checkEqual(Ljava/lang/String;II)V
.locals 0
if-ne p3, p2, :cond_0
return-void
.line 197
:cond_0
new-instance p0, Ljava/io/IOException;
invoke-static {p3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object p3
invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object p2
filled-new-array {p1, p3, p2}, [Ljava/lang/Object;
move-result-object p1
const/4 p2, 0x3
invoke-static {p1, p2}, Ljava/util/Arrays;->copyOf([Ljava/lang/Object;I)[Ljava/lang/Object;
move-result-object p1
const-string p2, "%s: actual 0x%08x != expected 0x%08x"
invoke-static {p2, p1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object p1
const-string p2, "java.lang.String.format(this, *args)"
invoke-static {p1, p2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
.end method
.method private final consumeHeader()V
.locals 17
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
move-object/from16 v6, p0
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
const-wide/16 v1, 0xa
.line 104
invoke-virtual {v0, v1, v2}, Lokio/RealBufferedSource;->require(J)V
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 222
iget-object v0, v0, Lokio/RealBufferedSource;->bufferField:Lokio/Buffer;
const-wide/16 v1, 0x3
.line 105
invoke-virtual {v0, v1, v2}, Lokio/Buffer;->getByte(J)B
move-result v7
shr-int/lit8 v0, v7, 0x1
const/4 v8, 0x1
and-int/2addr v0, v8
const/4 v9, 0x0
if-ne v0, v8, :cond_0
move v10, v8
goto :goto_0
:cond_0
move v10, v9
:goto_0
if-eqz v10, :cond_1
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 224
iget-object v1, v0, Lokio/RealBufferedSource;->bufferField:Lokio/Buffer;
const-wide/16 v2, 0x0
const-wide/16 v4, 0xa
move-object/from16 v0, p0
.line 107
invoke-direct/range {v0 .. v5}, Lokio/GzipSource;->updateCrc(Lokio/Buffer;JJ)V
:cond_1
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 109
invoke-virtual {v0}, Lokio/RealBufferedSource;->readShort()S
move-result v0
const-string v1, "ID1ID2"
const/16 v2, 0x1f8b
.line 110
invoke-direct {v6, v1, v2, v0}, Lokio/GzipSource;->checkEqual(Ljava/lang/String;II)V
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
const-wide/16 v1, 0x8
.line 111
invoke-virtual {v0, v1, v2}, Lokio/RealBufferedSource;->skip(J)V
shr-int/lit8 v0, v7, 0x2
and-int/2addr v0, v8
if-ne v0, v8, :cond_4
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
const-wide/16 v1, 0x2
.line 118
invoke-virtual {v0, v1, v2}, Lokio/RealBufferedSource;->require(J)V
if-eqz v10, :cond_2
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 226
iget-object v1, v0, Lokio/RealBufferedSource;->bufferField:Lokio/Buffer;
const-wide/16 v2, 0x0
const-wide/16 v4, 0x2
move-object/from16 v0, p0
.line 119
invoke-direct/range {v0 .. v5}, Lokio/GzipSource;->updateCrc(Lokio/Buffer;JJ)V
:cond_2
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 227
iget-object v0, v0, Lokio/RealBufferedSource;->bufferField:Lokio/Buffer;
.line 120
invoke-virtual {v0}, Lokio/Buffer;->readShortLe()S
move-result v0
int-to-long v11, v0
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 121
invoke-virtual {v0, v11, v12}, Lokio/RealBufferedSource;->require(J)V
if-eqz v10, :cond_3
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 228
iget-object v1, v0, Lokio/RealBufferedSource;->bufferField:Lokio/Buffer;
const-wide/16 v2, 0x0
move-object/from16 v0, p0
move-wide v4, v11
.line 122
invoke-direct/range {v0 .. v5}, Lokio/GzipSource;->updateCrc(Lokio/Buffer;JJ)V
:cond_3
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 123
invoke-virtual {v0, v11, v12}, Lokio/RealBufferedSource;->skip(J)V
:cond_4
shr-int/lit8 v0, v7, 0x3
and-int/2addr v0, v8
const-wide/16 v11, -0x1
const-wide/16 v13, 0x1
if-ne v0, v8, :cond_7
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 131
invoke-virtual {v0, v9}, Lokio/RealBufferedSource;->indexOf(B)J
move-result-wide v15
cmp-long v0, v15, v11
if-eqz v0, :cond_6
if-eqz v10, :cond_5
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 230
iget-object v1, v0, Lokio/RealBufferedSource;->bufferField:Lokio/Buffer;
const-wide/16 v2, 0x0
add-long v4, v15, v13
move-object/from16 v0, p0
.line 133
invoke-direct/range {v0 .. v5}, Lokio/GzipSource;->updateCrc(Lokio/Buffer;JJ)V
:cond_5
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
add-long v1, v15, v13
.line 134
invoke-virtual {v0, v1, v2}, Lokio/RealBufferedSource;->skip(J)V
goto :goto_1
.line 132
:cond_6
new-instance v0, Ljava/io/EOFException;
invoke-direct {v0}, Ljava/io/EOFException;-><init>()V
check-cast v0, Ljava/lang/Throwable;
throw v0
:cond_7
:goto_1
shr-int/lit8 v0, v7, 0x4
and-int/2addr v0, v8
if-ne v0, v8, :cond_a
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 142
invoke-virtual {v0, v9}, Lokio/RealBufferedSource;->indexOf(B)J
move-result-wide v7
cmp-long v0, v7, v11
if-eqz v0, :cond_9
if-eqz v10, :cond_8
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 232
iget-object v1, v0, Lokio/RealBufferedSource;->bufferField:Lokio/Buffer;
const-wide/16 v2, 0x0
add-long v4, v7, v13
move-object/from16 v0, p0
.line 144
invoke-direct/range {v0 .. v5}, Lokio/GzipSource;->updateCrc(Lokio/Buffer;JJ)V
:cond_8
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
add-long/2addr v7, v13
.line 145
invoke-virtual {v0, v7, v8}, Lokio/RealBufferedSource;->skip(J)V
goto :goto_2
.line 143
:cond_9
new-instance v0, Ljava/io/EOFException;
invoke-direct {v0}, Ljava/io/EOFException;-><init>()V
check-cast v0, Ljava/lang/Throwable;
throw v0
:cond_a
:goto_2
if-eqz v10, :cond_b
iget-object v0, v6, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 153
invoke-virtual {v0}, Lokio/RealBufferedSource;->readShortLe()S
move-result v0
iget-object v1, v6, Lokio/GzipSource;->crc:Ljava/util/zip/CRC32;
invoke-virtual {v1}, Ljava/util/zip/CRC32;->getValue()J
move-result-wide v1
long-to-int v1, v1
int-to-short v1, v1
const-string v2, "FHCRC"
invoke-direct {v6, v2, v0, v1}, Lokio/GzipSource;->checkEqual(Ljava/lang/String;II)V
iget-object v0, v6, Lokio/GzipSource;->crc:Ljava/util/zip/CRC32;
.line 154
invoke-virtual {v0}, Ljava/util/zip/CRC32;->reset()V
:cond_b
return-void
.end method
.method private final consumeTrailer()V
.locals 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-object v0, p0, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 164
invoke-virtual {v0}, Lokio/RealBufferedSource;->readIntLe()I
move-result v0
iget-object v1, p0, Lokio/GzipSource;->crc:Ljava/util/zip/CRC32;
invoke-virtual {v1}, Ljava/util/zip/CRC32;->getValue()J
move-result-wide v1
long-to-int v1, v1
const-string v2, "CRC"
invoke-direct {p0, v2, v0, v1}, Lokio/GzipSource;->checkEqual(Ljava/lang/String;II)V
iget-object v0, p0, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 165
invoke-virtual {v0}, Lokio/RealBufferedSource;->readIntLe()I
move-result v0
iget-object v1, p0, Lokio/GzipSource;->inflater:Ljava/util/zip/Inflater;
invoke-virtual {v1}, Ljava/util/zip/Inflater;->getBytesWritten()J
move-result-wide v1
long-to-int v1, v1
const-string v2, "ISIZE"
invoke-direct {p0, v2, v0, v1}, Lokio/GzipSource;->checkEqual(Ljava/lang/String;II)V
return-void
.end method
.method private final updateCrc(Lokio/Buffer;JJ)V
.locals 4
.line 178
iget-object p1, p1, Lokio/Buffer;->head:Lokio/Segment;
invoke-static {p1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V
.line 179
:goto_0
iget v0, p1, Lokio/Segment;->limit:I
iget v1, p1, Lokio/Segment;->pos:I
sub-int/2addr v0, v1
int-to-long v0, v0
cmp-long v0, p2, v0
if-ltz v0, :cond_0
.line 180
iget v0, p1, Lokio/Segment;->limit:I
iget v1, p1, Lokio/Segment;->pos:I
sub-int/2addr v0, v1
int-to-long v0, v0
sub-long/2addr p2, v0
.line 181
iget-object p1, p1, Lokio/Segment;->next:Lokio/Segment;
invoke-static {p1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V
goto :goto_0
:cond_0
:goto_1
const-wide/16 v0, 0x0
cmp-long v2, p4, v0
if-lez v2, :cond_1
.line 186
iget v2, p1, Lokio/Segment;->pos:I
int-to-long v2, v2
add-long/2addr v2, p2
long-to-int p2, v2
.line 187
iget p3, p1, Lokio/Segment;->limit:I
sub-int/2addr p3, p2
int-to-long v2, p3
.line 233
invoke-static {v2, v3, p4, p5}, Ljava/lang/Math;->min(JJ)J
move-result-wide v2
long-to-int p3, v2
iget-object v2, p0, Lokio/GzipSource;->crc:Ljava/util/zip/CRC32;
.line 188
iget-object v3, p1, Lokio/Segment;->data:[B
invoke-virtual {v2, v3, p2, p3}, Ljava/util/zip/CRC32;->update([BII)V
int-to-long p2, p3
sub-long/2addr p4, p2
.line 191
iget-object p1, p1, Lokio/Segment;->next:Lokio/Segment;
invoke-static {p1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V
move-wide p2, v0
goto :goto_1
:cond_1
return-void
.end method
# virtual methods
.method public close()V
.locals 0
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-object p0, p0, Lokio/GzipSource;->inflaterSource:Lokio/InflaterSource;
.line 171
invoke-virtual {p0}, Lokio/InflaterSource;->close()V
return-void
.end method
.method public read(Lokio/Buffer;J)J
.locals 11
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const-string v0, "sink"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
const-wide/16 v0, 0x0
cmp-long v2, p2, v0
const/4 v3, 0x1
if-ltz v2, :cond_0
move v4, v3
goto :goto_0
:cond_0
const/4 v4, 0x0
:goto_0
if-eqz v4, :cond_7
if-nez v2, :cond_1
return-wide v0
:cond_1
iget-byte v0, p0, Lokio/GzipSource;->section:B
if-nez v0, :cond_2
.line 62
invoke-direct {p0}, Lokio/GzipSource;->consumeHeader()V
iput-byte v3, p0, Lokio/GzipSource;->section:B
:cond_2
iget-byte v0, p0, Lokio/GzipSource;->section:B
const-wide/16 v1, -0x1
const/4 v4, 0x2
if-ne v0, v3, :cond_4
.line 68
invoke-virtual {p1}, Lokio/Buffer;->size()J
move-result-wide v7
iget-object v0, p0, Lokio/GzipSource;->inflaterSource:Lokio/InflaterSource;
.line 69
invoke-virtual {v0, p1, p2, p3}, Lokio/InflaterSource;->read(Lokio/Buffer;J)J
move-result-wide p2
cmp-long v0, p2, v1
if-eqz v0, :cond_3
move-object v5, p0
move-object v6, p1
move-wide v9, p2
.line 71
invoke-direct/range {v5 .. v10}, Lokio/GzipSource;->updateCrc(Lokio/Buffer;JJ)V
return-wide p2
:cond_3
iput-byte v4, p0, Lokio/GzipSource;->section:B
:cond_4
iget-byte p1, p0, Lokio/GzipSource;->section:B
if-ne p1, v4, :cond_6
.line 81
invoke-direct {p0}, Lokio/GzipSource;->consumeTrailer()V
const/4 p1, 0x3
iput-byte p1, p0, Lokio/GzipSource;->section:B
iget-object p0, p0, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 88
invoke-virtual {p0}, Lokio/RealBufferedSource;->exhausted()Z
move-result p0
if-eqz p0, :cond_5
goto :goto_1
.line 89
:cond_5
new-instance p0, Ljava/io/IOException;
const-string p1, "gzip finished without exhausting source"
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
:cond_6
:goto_1
return-wide v1
.line 57
:cond_7
new-instance p0, Ljava/lang/StringBuilder;
const-string p1, "byteCount < 0: "
invoke-direct {p0, p1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p0, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
new-instance p1, Ljava/lang/IllegalArgumentException;
invoke-virtual {p0}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p0
invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast p1, Ljava/lang/Throwable;
throw p1
.end method
.method public timeout()Lokio/Timeout;
.locals 0
iget-object p0, p0, Lokio/GzipSource;->source:Lokio/RealBufferedSource;
.line 168
invoke-virtual {p0}, Lokio/RealBufferedSource;->timeout()Lokio/Timeout;
move-result-object p0
return-object p0
.end method