Rabbit-R1/switch port/smali/smali_classes3/kotlin/io/LineReader.smali
2024-05-21 17:08:36 -04:00

678 lines
17 KiB
Smali

.class public final Lkotlin/io/LineReader;
.super Ljava/lang/Object;
.source "Console.kt"
# annotations
.annotation system Ldalvik/annotation/SourceDebugExtension;
value = "SMAP\nConsole.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Console.kt\nkotlin/io/LineReader\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,299:1\n1#2:300\n*E\n"
.end annotation
.annotation runtime Lkotlin/Metadata;
d1 = {
"\u0000\\\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0008\u0002\n\u0002\u0010\u0008\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0019\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0007\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\u0008\u0003\u0008\u00c0\u0002\u0018\u00002\u00020\u0001B\u0007\u0008\u0002\u00a2\u0006\u0002\u0010\u0002J\u0008\u0010\u0014\u001a\u00020\u0004H\u0002J\u0010\u0010\u0015\u001a\u00020\u00042\u0006\u0010\u0016\u001a\u00020\u0010H\u0002J\u0018\u0010\u0017\u001a\u00020\u00042\u0006\u0010\u0018\u001a\u00020\u00042\u0006\u0010\u0019\u001a\u00020\u0004H\u0002J\u0018\u0010\u001a\u001a\u0004\u0018\u00010\u001b2\u0006\u0010\u001c\u001a\u00020\u001d2\u0006\u0010\u001e\u001a\u00020\u001fJ\u0008\u0010 \u001a\u00020!H\u0002J\u0008\u0010\"\u001a\u00020!H\u0002J\u0010\u0010#\u001a\u00020!2\u0006\u0010\u001e\u001a\u00020\u001fH\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0008X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\nX\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u000cX\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0082.\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0010X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u0012\u0010\u0011\u001a\u00060\u0012j\u0002`\u0013X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006$"
}
d2 = {
"Lkotlin/io/LineReader;",
"",
"()V",
"BUFFER_SIZE",
"",
"byteBuf",
"Ljava/nio/ByteBuffer;",
"bytes",
"",
"charBuf",
"Ljava/nio/CharBuffer;",
"chars",
"",
"decoder",
"Ljava/nio/charset/CharsetDecoder;",
"directEOL",
"",
"sb",
"Ljava/lang/StringBuilder;",
"Lkotlin/text/StringBuilder;",
"compactBytes",
"decode",
"endOfInput",
"decodeEndOfInput",
"nBytes",
"nChars",
"readLine",
"",
"inputStream",
"Ljava/io/InputStream;",
"charset",
"Ljava/nio/charset/Charset;",
"resetAll",
"",
"trimStringBuilder",
"updateCharset",
"kotlin-stdlib"
}
k = 0x1
mv = {
0x1,
0x9,
0x0
}
xi = 0x30
.end annotation
# static fields
.field private static final BUFFER_SIZE:I = 0x20
.field public static final INSTANCE:Lkotlin/io/LineReader;
.field private static final byteBuf:Ljava/nio/ByteBuffer;
.field private static final bytes:[B
.field private static final charBuf:Ljava/nio/CharBuffer;
.field private static final chars:[C
.field private static decoder:Ljava/nio/charset/CharsetDecoder;
.field private static directEOL:Z
.field private static final sb:Ljava/lang/StringBuilder;
# direct methods
.method static constructor <clinit>()V
.locals 3
new-instance v0, Lkotlin/io/LineReader;
invoke-direct {v0}, Lkotlin/io/LineReader;-><init>()V
sput-object v0, Lkotlin/io/LineReader;->INSTANCE:Lkotlin/io/LineReader;
const/16 v0, 0x20
new-array v1, v0, [B
sput-object v1, Lkotlin/io/LineReader;->bytes:[B
new-array v0, v0, [C
sput-object v0, Lkotlin/io/LineReader;->chars:[C
.line 179
invoke-static {v1}, Ljava/nio/ByteBuffer;->wrap([B)Ljava/nio/ByteBuffer;
move-result-object v1
const-string v2, "wrap(...)"
invoke-static {v1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
sput-object v1, Lkotlin/io/LineReader;->byteBuf:Ljava/nio/ByteBuffer;
.line 180
invoke-static {v0}, Ljava/nio/CharBuffer;->wrap([C)Ljava/nio/CharBuffer;
move-result-object v0
invoke-static {v0, v2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
sput-object v0, Lkotlin/io/LineReader;->charBuf:Ljava/nio/CharBuffer;
.line 181
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
sput-object v0, Lkotlin/io/LineReader;->sb:Ljava/lang/StringBuilder;
return-void
.end method
.method private constructor <init>()V
.locals 0
.line 173
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private final compactBytes()I
.locals 2
sget-object p0, Lkotlin/io/LineReader;->byteBuf:Ljava/nio/ByteBuffer;
.line 258
invoke-virtual {p0}, Ljava/nio/ByteBuffer;->compact()Ljava/nio/ByteBuffer;
.line 259
invoke-virtual {p0}, Ljava/nio/ByteBuffer;->position()I
move-result v0
const/4 v1, 0x0
invoke-virtual {p0, v1}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;
return v0
.end method
.method private final decode(Z)I
.locals 5
:goto_0
sget-object v0, Lkotlin/io/LineReader;->decoder:Ljava/nio/charset/CharsetDecoder;
if-nez v0, :cond_0
const-string v0, "decoder"
.line 241
invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->throwUninitializedPropertyAccessException(Ljava/lang/String;)V
const/4 v0, 0x0
:cond_0
sget-object v1, Lkotlin/io/LineReader;->byteBuf:Ljava/nio/ByteBuffer;
sget-object v2, Lkotlin/io/LineReader;->charBuf:Ljava/nio/CharBuffer;
invoke-virtual {v0, v1, v2, p1}, Ljava/nio/charset/CharsetDecoder;->decode(Ljava/nio/ByteBuffer;Ljava/nio/CharBuffer;Z)Ljava/nio/charset/CoderResult;
move-result-object v0
const-string v1, "decode(...)"
invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
.line 242
invoke-virtual {v0}, Ljava/nio/charset/CoderResult;->isError()Z
move-result v1
if-eqz v1, :cond_1
.line 243
invoke-direct {p0}, Lkotlin/io/LineReader;->resetAll()V
.line 244
invoke-virtual {v0}, Ljava/nio/charset/CoderResult;->throwException()V
.line 246
:cond_1
invoke-virtual {v2}, Ljava/nio/CharBuffer;->position()I
move-result v1
.line 247
invoke-virtual {v0}, Ljava/nio/charset/CoderResult;->isOverflow()Z
move-result v0
if-nez v0, :cond_2
return v1
:cond_2
sget-object v0, Lkotlin/io/LineReader;->sb:Ljava/lang/StringBuilder;
sget-object v3, Lkotlin/io/LineReader;->chars:[C
add-int/lit8 v1, v1, -0x1
const/4 v4, 0x0
.line 249
invoke-virtual {v0, v3, v4, v1}, Ljava/lang/StringBuilder;->append([CII)Ljava/lang/StringBuilder;
.line 250
invoke-virtual {v2, v4}, Ljava/nio/CharBuffer;->position(I)Ljava/nio/Buffer;
const/16 v0, 0x20
.line 251
invoke-virtual {v2, v0}, Ljava/nio/CharBuffer;->limit(I)Ljava/nio/Buffer;
.line 252
aget-char v0, v3, v1
invoke-virtual {v2, v0}, Ljava/nio/CharBuffer;->put(C)Ljava/nio/CharBuffer;
goto :goto_0
.end method
.method private final decodeEndOfInput(II)I
.locals 1
sget-object v0, Lkotlin/io/LineReader;->byteBuf:Ljava/nio/ByteBuffer;
.line 264
invoke-virtual {v0, p1}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
sget-object p1, Lkotlin/io/LineReader;->charBuf:Ljava/nio/CharBuffer;
.line 265
invoke-virtual {p1, p2}, Ljava/nio/CharBuffer;->position(I)Ljava/nio/Buffer;
const/4 p1, 0x1
.line 266
invoke-direct {p0, p1}, Lkotlin/io/LineReader;->decode(Z)I
move-result p0
sget-object p1, Lkotlin/io/LineReader;->decoder:Ljava/nio/charset/CharsetDecoder;
if-nez p1, :cond_0
const-string p1, "decoder"
.line 268
invoke-static {p1}, Lkotlin/jvm/internal/Intrinsics;->throwUninitializedPropertyAccessException(Ljava/lang/String;)V
const/4 p1, 0x0
:cond_0
invoke-virtual {p1}, Ljava/nio/charset/CharsetDecoder;->reset()Ljava/nio/charset/CharsetDecoder;
const/4 p1, 0x0
.line 269
invoke-virtual {v0, p1}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;
return p0
.end method
.method private final resetAll()V
.locals 1
sget-object p0, Lkotlin/io/LineReader;->decoder:Ljava/nio/charset/CharsetDecoder;
if-nez p0, :cond_0
const-string p0, "decoder"
.line 288
invoke-static {p0}, Lkotlin/jvm/internal/Intrinsics;->throwUninitializedPropertyAccessException(Ljava/lang/String;)V
const/4 p0, 0x0
:cond_0
invoke-virtual {p0}, Ljava/nio/charset/CharsetDecoder;->reset()Ljava/nio/charset/CharsetDecoder;
sget-object p0, Lkotlin/io/LineReader;->byteBuf:Ljava/nio/ByteBuffer;
const/4 v0, 0x0
.line 289
invoke-virtual {p0, v0}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;
sget-object p0, Lkotlin/io/LineReader;->sb:Ljava/lang/StringBuilder;
.line 290
invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->setLength(I)V
return-void
.end method
.method private final trimStringBuilder()V
.locals 1
sget-object p0, Lkotlin/io/LineReader;->sb:Ljava/lang/StringBuilder;
const/16 v0, 0x20
.line 295
invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->setLength(I)V
.line 296
invoke-virtual {p0}, Ljava/lang/StringBuilder;->trimToSize()V
return-void
.end method
.method private final updateCharset(Ljava/nio/charset/Charset;)V
.locals 4
.line 275
invoke-virtual {p1}, Ljava/nio/charset/Charset;->newDecoder()Ljava/nio/charset/CharsetDecoder;
move-result-object p1
const-string v0, "newDecoder(...)"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
sput-object p1, Lkotlin/io/LineReader;->decoder:Ljava/nio/charset/CharsetDecoder;
sget-object p1, Lkotlin/io/LineReader;->byteBuf:Ljava/nio/ByteBuffer;
.line 277
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;
sget-object v0, Lkotlin/io/LineReader;->charBuf:Ljava/nio/CharBuffer;
.line 278
invoke-virtual {v0}, Ljava/nio/CharBuffer;->clear()Ljava/nio/Buffer;
const/16 v1, 0xa
.line 279
invoke-virtual {p1, v1}, Ljava/nio/ByteBuffer;->put(B)Ljava/nio/ByteBuffer;
.line 280
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->flip()Ljava/nio/Buffer;
sget-object v2, Lkotlin/io/LineReader;->decoder:Ljava/nio/charset/CharsetDecoder;
if-nez v2, :cond_0
const-string v2, "decoder"
.line 281
invoke-static {v2}, Lkotlin/jvm/internal/Intrinsics;->throwUninitializedPropertyAccessException(Ljava/lang/String;)V
const/4 v2, 0x0
:cond_0
const/4 v3, 0x0
invoke-virtual {v2, p1, v0, v3}, Ljava/nio/charset/CharsetDecoder;->decode(Ljava/nio/ByteBuffer;Ljava/nio/CharBuffer;Z)Ljava/nio/charset/CoderResult;
.line 282
invoke-virtual {v0}, Ljava/nio/CharBuffer;->position()I
move-result p1
const/4 v2, 0x1
if-ne p1, v2, :cond_1
invoke-virtual {v0, v3}, Ljava/nio/CharBuffer;->get(I)C
move-result p1
if-ne p1, v1, :cond_1
move v3, v2
:cond_1
sput-boolean v3, Lkotlin/io/LineReader;->directEOL:Z
.line 283
invoke-direct {p0}, Lkotlin/io/LineReader;->resetAll()V
return-void
.end method
# virtual methods
.method public final declared-synchronized readLine(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/String;
.locals 9
monitor-enter p0
:try_start_0
const-string v0, "inputStream"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "charset"
invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
sget-object v0, Lkotlin/io/LineReader;->decoder:Ljava/nio/charset/CharsetDecoder;
const/4 v1, 0x0
if-eqz v0, :cond_1
if-nez v0, :cond_0
const-string v0, "decoder"
.line 191
invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->throwUninitializedPropertyAccessException(Ljava/lang/String;)V
move-object v0, v1
:cond_0
invoke-virtual {v0}, Ljava/nio/charset/CharsetDecoder;->charset()Ljava/nio/charset/Charset;
move-result-object v0
invoke-static {v0, p2}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_2
:cond_1
invoke-direct {p0, p2}, Lkotlin/io/LineReader;->updateCharset(Ljava/nio/charset/Charset;)V
:cond_2
const/4 p2, 0x0
move v0, p2
move v2, v0
.line 195
:goto_0
invoke-virtual {p1}, Ljava/io/InputStream;->read()I
move-result v3
const/16 v4, 0x20
const/4 v5, -0x1
const/16 v6, 0xa
if-ne v3, v5, :cond_4
sget-object p1, Lkotlin/io/LineReader;->sb:Ljava/lang/StringBuilder;
.line 198
check-cast p1, Ljava/lang/CharSequence;
invoke-interface {p1}, Ljava/lang/CharSequence;->length()I
move-result p1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-nez p1, :cond_3
if-nez v0, :cond_3
if-nez v2, :cond_3
.line 199
monitor-exit p0
return-object v1
.line 201
:cond_3
:try_start_1
invoke-direct {p0, v0, v2}, Lkotlin/io/LineReader;->decodeEndOfInput(II)I
move-result p1
goto :goto_2
:cond_4
sget-object v5, Lkotlin/io/LineReader;->bytes:[B
add-int/lit8 v7, v0, 0x1
int-to-byte v8, v3
.line 205
aput-byte v8, v5, v0
if-eq v3, v6, :cond_6
if-eq v7, v4, :cond_6
sget-boolean v0, Lkotlin/io/LineReader;->directEOL:Z
if-nez v0, :cond_5
goto :goto_1
:cond_5
move v0, v7
goto :goto_0
:cond_6
:goto_1
sget-object v0, Lkotlin/io/LineReader;->byteBuf:Ljava/nio/ByteBuffer;
.line 210
invoke-virtual {v0, v7}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
sget-object v3, Lkotlin/io/LineReader;->charBuf:Ljava/nio/CharBuffer;
.line 211
invoke-virtual {v3, v2}, Ljava/nio/CharBuffer;->position(I)Ljava/nio/Buffer;
.line 212
invoke-direct {p0, p2}, Lkotlin/io/LineReader;->decode(Z)I
move-result v2
if-lez v2, :cond_b
sget-object v3, Lkotlin/io/LineReader;->chars:[C
add-int/lit8 v5, v2, -0x1
.line 214
aget-char v3, v3, v5
if-ne v3, v6, :cond_b
.line 215
invoke-virtual {v0, p2}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;
move p1, v2
:goto_2
if-lez p1, :cond_8
sget-object v0, Lkotlin/io/LineReader;->chars:[C
add-int/lit8 v1, p1, -0x1
.line 223
aget-char v1, v0, v1
if-ne v1, v6, :cond_8
add-int/lit8 v1, p1, -0x1
if-lez v1, :cond_7
add-int/lit8 v2, p1, -0x2
.line 225
aget-char v0, v0, v2
const/16 v2, 0xd
if-ne v0, v2, :cond_7
add-int/lit8 p1, p1, -0x2
goto :goto_3
:cond_7
move p1, v1
:cond_8
:goto_3
sget-object v0, Lkotlin/io/LineReader;->sb:Ljava/lang/StringBuilder;
.line 228
move-object v1, v0
check-cast v1, Ljava/lang/CharSequence;
invoke-interface {v1}, Ljava/lang/CharSequence;->length()I
move-result v1
if-nez v1, :cond_9
new-instance v0, Ljava/lang/String;
sget-object v1, Lkotlin/io/LineReader;->chars:[C
invoke-direct {v0, v1, p2, p1}, Ljava/lang/String;-><init>([CII)V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
monitor-exit p0
return-object v0
:cond_9
:try_start_2
sget-object v1, Lkotlin/io/LineReader;->chars:[C
.line 230
invoke-virtual {v0, v1, p2, p1}, Ljava/lang/StringBuilder;->append([CII)Ljava/lang/StringBuilder;
.line 232
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
const-string v1, "toString(...)"
invoke-static {p1, v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
.line 233
invoke-virtual {v0}, Ljava/lang/StringBuilder;->length()I
move-result v1
if-le v1, v4, :cond_a
invoke-direct {p0}, Lkotlin/io/LineReader;->trimStringBuilder()V
.line 234
:cond_a
invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->setLength(I)V
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_0
.line 235
monitor-exit p0
return-object p1
.line 219
:cond_b
:try_start_3
invoke-direct {p0}, Lkotlin/io/LineReader;->compactBytes()I
move-result v0
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_0
goto/16 :goto_0
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method