mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
695 lines
15 KiB
Smali
695 lines
15 KiB
Smali
.class Landroidx/profileinstaller/Encoding;
|
|
.super Ljava/lang/Object;
|
|
.source "Encoding.java"
|
|
|
|
|
|
# static fields
|
|
.field static final SIZEOF_BYTE:I = 0x8
|
|
|
|
.field static final UINT_16_SIZE:I = 0x2
|
|
|
|
.field static final UINT_32_SIZE:I = 0x4
|
|
|
|
.field static final UINT_8_SIZE:I = 0x1
|
|
|
|
|
|
# direct methods
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 38
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static bitsToBytes(I)I
|
|
.locals 0
|
|
|
|
add-int/lit8 p0, p0, 0x7
|
|
|
|
and-int/lit8 p0, p0, -0x8
|
|
|
|
.line 75
|
|
div-int/lit8 p0, p0, 0x8
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method static compress([B)[B
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 177
|
|
new-instance v0, Ljava/util/zip/Deflater;
|
|
|
|
const/4 v1, 0x1
|
|
|
|
invoke-direct {v0, v1}, Ljava/util/zip/Deflater;-><init>(I)V
|
|
|
|
.line 178
|
|
new-instance v1, Ljava/io/ByteArrayOutputStream;
|
|
|
|
invoke-direct {v1}, Ljava/io/ByteArrayOutputStream;-><init>()V
|
|
|
|
.line 179
|
|
:try_start_0
|
|
new-instance v2, Ljava/util/zip/DeflaterOutputStream;
|
|
|
|
invoke-direct {v2, v1, v0}, Ljava/util/zip/DeflaterOutputStream;-><init>(Ljava/io/OutputStream;Ljava/util/zip/Deflater;)V
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_2
|
|
|
|
.line 180
|
|
:try_start_1
|
|
invoke-virtual {v2, p0}, Ljava/util/zip/DeflaterOutputStream;->write([B)V
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
.line 181
|
|
:try_start_2
|
|
invoke-virtual {v2}, Ljava/util/zip/DeflaterOutputStream;->close()V
|
|
:try_end_2
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_2
|
|
|
|
.line 182
|
|
invoke-virtual {v0}, Ljava/util/zip/Deflater;->end()V
|
|
|
|
.line 184
|
|
invoke-virtual {v1}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
.line 179
|
|
:try_start_3
|
|
invoke-virtual {v2}, Ljava/util/zip/DeflaterOutputStream;->close()V
|
|
:try_end_3
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_1
|
|
|
|
goto :goto_0
|
|
|
|
:catchall_1
|
|
move-exception v1
|
|
|
|
:try_start_4
|
|
invoke-virtual {p0, v1}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
|
|
|
|
:goto_0
|
|
throw p0
|
|
:try_end_4
|
|
.catchall {:try_start_4 .. :try_end_4} :catchall_2
|
|
|
|
:catchall_2
|
|
move-exception p0
|
|
|
|
.line 182
|
|
invoke-virtual {v0}, Ljava/util/zip/Deflater;->end()V
|
|
|
|
.line 183
|
|
throw p0
|
|
.end method
|
|
|
|
.method static error(Ljava/lang/String;)Ljava/lang/RuntimeException;
|
|
.locals 1
|
|
|
|
.line 196
|
|
new-instance v0, Ljava/lang/IllegalStateException;
|
|
|
|
invoke-direct {v0, p0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method static read(Ljava/io/InputStream;I)[B
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 79
|
|
new-array v0, p1, [B
|
|
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
if-ge v1, p1, :cond_1
|
|
|
|
sub-int v2, p1, v1
|
|
|
|
.line 82
|
|
invoke-virtual {p0, v0, v1, v2}, Ljava/io/InputStream;->read([BII)I
|
|
|
|
move-result v2
|
|
|
|
if-ltz v2, :cond_0
|
|
|
|
add-int/2addr v1, v2
|
|
|
|
goto :goto_0
|
|
|
|
.line 84
|
|
:cond_0
|
|
new-instance p0, Ljava/lang/StringBuilder;
|
|
|
|
const-string v0, "Not enough bytes to read: "
|
|
|
|
invoke-direct {p0, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0}, Landroidx/profileinstaller/Encoding;->error(Ljava/lang/String;)Ljava/lang/RuntimeException;
|
|
|
|
move-result-object p0
|
|
|
|
throw p0
|
|
|
|
:cond_1
|
|
return-object v0
|
|
.end method
|
|
|
|
.method static readCompressed(Ljava/io/InputStream;II)[B
|
|
.locals 8
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 123
|
|
new-instance v0, Ljava/util/zip/Inflater;
|
|
|
|
invoke-direct {v0}, Ljava/util/zip/Inflater;-><init>()V
|
|
|
|
.line 125
|
|
:try_start_0
|
|
new-array v1, p2, [B
|
|
|
|
const/16 v2, 0x800
|
|
|
|
new-array v2, v2, [B
|
|
|
|
const/4 v3, 0x0
|
|
|
|
move v4, v3
|
|
|
|
move v5, v4
|
|
|
|
.line 130
|
|
:goto_0
|
|
invoke-virtual {v0}, Ljava/util/zip/Inflater;->finished()Z
|
|
|
|
move-result v6
|
|
|
|
if-nez v6, :cond_1
|
|
|
|
.line 131
|
|
invoke-virtual {v0}, Ljava/util/zip/Inflater;->needsDictionary()Z
|
|
|
|
move-result v6
|
|
|
|
if-nez v6, :cond_1
|
|
|
|
if-ge v4, p1, :cond_1
|
|
|
|
.line 134
|
|
invoke-virtual {p0, v2}, Ljava/io/InputStream;->read([B)I
|
|
|
|
move-result v6
|
|
|
|
if-ltz v6, :cond_0
|
|
|
|
.line 141
|
|
invoke-virtual {v0, v2, v3, v6}, Ljava/util/zip/Inflater;->setInput([BII)V
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
sub-int v7, p2, v5
|
|
|
|
.line 143
|
|
:try_start_1
|
|
invoke-virtual {v0, v1, v5, v7}, Ljava/util/zip/Inflater;->inflate([BII)I
|
|
|
|
move-result v7
|
|
:try_end_1
|
|
.catch Ljava/util/zip/DataFormatException; {:try_start_1 .. :try_end_1} :catch_0
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
add-int/2addr v5, v7
|
|
|
|
add-int/2addr v4, v6
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 149
|
|
:try_start_2
|
|
invoke-virtual {p0}, Ljava/util/zip/DataFormatException;->getMessage()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0}, Landroidx/profileinstaller/Encoding;->error(Ljava/lang/String;)Ljava/lang/RuntimeException;
|
|
|
|
move-result-object p0
|
|
|
|
throw p0
|
|
|
|
.line 136
|
|
:cond_0
|
|
new-instance p0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string p2, "Invalid zip data. Stream ended after $totalBytesRead bytes. Expected "
|
|
|
|
invoke-virtual {p0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, " bytes"
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0}, Landroidx/profileinstaller/Encoding;->error(Ljava/lang/String;)Ljava/lang/RuntimeException;
|
|
|
|
move-result-object p0
|
|
|
|
throw p0
|
|
|
|
:cond_1
|
|
if-ne v4, p1, :cond_3
|
|
|
|
.line 160
|
|
invoke-virtual {v0}, Ljava/util/zip/Inflater;->finished()Z
|
|
|
|
move-result p0
|
|
:try_end_2
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
|
|
|
if-eqz p0, :cond_2
|
|
|
|
.line 165
|
|
invoke-virtual {v0}, Ljava/util/zip/Inflater;->end()V
|
|
|
|
return-object v1
|
|
|
|
:cond_2
|
|
:try_start_3
|
|
const-string p0, "Inflater did not finish"
|
|
|
|
.line 161
|
|
invoke-static {p0}, Landroidx/profileinstaller/Encoding;->error(Ljava/lang/String;)Ljava/lang/RuntimeException;
|
|
|
|
move-result-object p0
|
|
|
|
throw p0
|
|
|
|
.line 154
|
|
:cond_3
|
|
new-instance p0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string p2, "Didn\'t read enough bytes during decompression. expected="
|
|
|
|
invoke-virtual {p0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, " actual="
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0}, Landroidx/profileinstaller/Encoding;->error(Ljava/lang/String;)Ljava/lang/RuntimeException;
|
|
|
|
move-result-object p0
|
|
|
|
throw p0
|
|
:try_end_3
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
.line 165
|
|
invoke-virtual {v0}, Ljava/util/zip/Inflater;->end()V
|
|
|
|
.line 166
|
|
throw p0
|
|
.end method
|
|
|
|
.method static readString(Ljava/io/InputStream;I)Ljava/lang/String;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 114
|
|
new-instance v0, Ljava/lang/String;
|
|
|
|
invoke-static {p0, p1}, Landroidx/profileinstaller/Encoding;->read(Ljava/io/InputStream;I)[B
|
|
|
|
move-result-object p0
|
|
|
|
sget-object p1, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset;
|
|
|
|
invoke-direct {v0, p0, p1}, Ljava/lang/String;-><init>([BLjava/nio/charset/Charset;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method static readUInt(Ljava/io/InputStream;I)J
|
|
.locals 6
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 92
|
|
invoke-static {p0, p1}, Landroidx/profileinstaller/Encoding;->read(Ljava/io/InputStream;I)[B
|
|
|
|
move-result-object p0
|
|
|
|
const-wide/16 v0, 0x0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
:goto_0
|
|
if-ge v2, p1, :cond_0
|
|
|
|
.line 95
|
|
aget-byte v3, p0, v2
|
|
|
|
and-int/lit16 v3, v3, 0xff
|
|
|
|
int-to-long v3, v3
|
|
|
|
mul-int/lit8 v5, v2, 0x8
|
|
|
|
shl-long/2addr v3, v5
|
|
|
|
add-long/2addr v0, v3
|
|
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
return-wide v0
|
|
.end method
|
|
|
|
.method static readUInt16(Ljava/io/InputStream;)I
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x2
|
|
|
|
.line 106
|
|
invoke-static {p0, v0}, Landroidx/profileinstaller/Encoding;->readUInt(Ljava/io/InputStream;I)J
|
|
|
|
move-result-wide v0
|
|
|
|
long-to-int p0, v0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method static readUInt32(Ljava/io/InputStream;)J
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x4
|
|
|
|
.line 110
|
|
invoke-static {p0, v0}, Landroidx/profileinstaller/Encoding;->readUInt(Ljava/io/InputStream;I)J
|
|
|
|
move-result-wide v0
|
|
|
|
return-wide v0
|
|
.end method
|
|
|
|
.method static readUInt8(Ljava/io/InputStream;)I
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x1
|
|
|
|
.line 102
|
|
invoke-static {p0, v0}, Landroidx/profileinstaller/Encoding;->readUInt(Ljava/io/InputStream;I)J
|
|
|
|
move-result-wide v0
|
|
|
|
long-to-int p0, v0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method static utf8Length(Ljava/lang/String;)I
|
|
.locals 1
|
|
|
|
.line 46
|
|
sget-object v0, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset;
|
|
|
|
invoke-virtual {p0, v0}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B
|
|
|
|
move-result-object p0
|
|
|
|
array-length p0, p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method static writeAll(Ljava/io/InputStream;Ljava/io/OutputStream;)V
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
const/16 v0, 0x200
|
|
|
|
new-array v0, v0, [B
|
|
|
|
.line 190
|
|
:goto_0
|
|
invoke-virtual {p0, v0}, Ljava/io/InputStream;->read([B)I
|
|
|
|
move-result v1
|
|
|
|
if-lez v1, :cond_0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
.line 191
|
|
invoke-virtual {p1, v0, v2, v1}, Ljava/io/OutputStream;->write([BII)V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method static writeCompressed(Ljava/io/OutputStream;[B)V
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 170
|
|
array-length v0, p1
|
|
|
|
int-to-long v0, v0
|
|
|
|
invoke-static {p0, v0, v1}, Landroidx/profileinstaller/Encoding;->writeUInt32(Ljava/io/OutputStream;J)V
|
|
|
|
.line 171
|
|
invoke-static {p1}, Landroidx/profileinstaller/Encoding;->compress([B)[B
|
|
|
|
move-result-object p1
|
|
|
|
.line 172
|
|
array-length v0, p1
|
|
|
|
int-to-long v0, v0
|
|
|
|
invoke-static {p0, v0, v1}, Landroidx/profileinstaller/Encoding;->writeUInt32(Ljava/io/OutputStream;J)V
|
|
|
|
.line 173
|
|
invoke-virtual {p0, p1}, Ljava/io/OutputStream;->write([B)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static writeString(Ljava/io/OutputStream;Ljava/lang/String;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 71
|
|
sget-object v0, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset;
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p0, p1}, Ljava/io/OutputStream;->write([B)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static writeUInt(Ljava/io/OutputStream;JI)V
|
|
.locals 6
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 51
|
|
new-array v0, p3, [B
|
|
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
if-ge v1, p3, :cond_0
|
|
|
|
mul-int/lit8 v2, v1, 0x8
|
|
|
|
shr-long v2, p1, v2
|
|
|
|
const-wide/16 v4, 0xff
|
|
|
|
and-long/2addr v2, v4
|
|
|
|
long-to-int v2, v2
|
|
|
|
int-to-byte v2, v2
|
|
|
|
.line 53
|
|
aput-byte v2, v0, v1
|
|
|
|
add-int/lit8 v1, v1, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
.line 55
|
|
:cond_0
|
|
invoke-virtual {p0, v0}, Ljava/io/OutputStream;->write([B)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static writeUInt16(Ljava/io/OutputStream;I)V
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
int-to-long v0, p1
|
|
|
|
const/4 p1, 0x2
|
|
|
|
.line 63
|
|
invoke-static {p0, v0, v1, p1}, Landroidx/profileinstaller/Encoding;->writeUInt(Ljava/io/OutputStream;JI)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static writeUInt32(Ljava/io/OutputStream;J)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x4
|
|
|
|
.line 67
|
|
invoke-static {p0, p1, p2, v0}, Landroidx/profileinstaller/Encoding;->writeUInt(Ljava/io/OutputStream;JI)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static writeUInt8(Ljava/io/OutputStream;I)V
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
int-to-long v0, p1
|
|
|
|
const/4 p1, 0x1
|
|
|
|
.line 59
|
|
invoke-static {p0, v0, v1, p1}, Landroidx/profileinstaller/Encoding;->writeUInt(Ljava/io/OutputStream;JI)V
|
|
|
|
return-void
|
|
.end method
|