apkfuckery/com.discord/smali/com/bugsnag/android/JsonWriter.smali
2019-02-04 21:05:16 +01:00

1447 lines
36 KiB
Smali

.class Lcom/bugsnag/android/JsonWriter;
.super Ljava/lang/Object;
.source "JsonWriter.java"
# interfaces
.implements Ljava/io/Closeable;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/bugsnag/android/JsonWriter$JsonScope;
}
.end annotation
# static fields
.field private static final HTML_SAFE_REPLACEMENT_CHARS:[Ljava/lang/String;
.field private static final REPLACEMENT_CHARS:[Ljava/lang/String;
# instance fields
.field private deferredName:Ljava/lang/String;
.field private htmlSafe:Z
.field private indent:Ljava/lang/String;
.field private lenient:Z
.field private final out:Ljava/io/Writer;
.field private separator:Ljava/lang/String;
.field private serializeNulls:Z
.field private final stack:Ljava/util/List;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/List",
"<",
"Lcom/bugsnag/android/JsonWriter$JsonScope;",
">;"
}
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.locals 6
.prologue
const/16 v1, 0x80
new-array v1, v1, [Ljava/lang/String;
sput-object v1, Lcom/bugsnag/android/JsonWriter;->REPLACEMENT_CHARS:[Ljava/lang/String;
const/4 v0, 0x0
.local v0, "i":I
:goto_0
const/16 v1, 0x1f
if-gt v0, v1, :cond_0
sget-object v1, Lcom/bugsnag/android/JsonWriter;->REPLACEMENT_CHARS:[Ljava/lang/String;
const-string v2, "\\u%04x"
const/4 v3, 0x1
new-array v3, v3, [Ljava/lang/Object;
const/4 v4, 0x0
invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v5
aput-object v5, v3, v4
invoke-static {v2, v3}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v2
aput-object v2, v1, v0
add-int/lit8 v0, v0, 0x1
goto :goto_0
:cond_0
sget-object v1, Lcom/bugsnag/android/JsonWriter;->REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0x22
const-string v3, "\\\""
aput-object v3, v1, v2
sget-object v1, Lcom/bugsnag/android/JsonWriter;->REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0x5c
const-string v3, "\\\\"
aput-object v3, v1, v2
sget-object v1, Lcom/bugsnag/android/JsonWriter;->REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0x9
const-string v3, "\\t"
aput-object v3, v1, v2
sget-object v1, Lcom/bugsnag/android/JsonWriter;->REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0x8
const-string v3, "\\b"
aput-object v3, v1, v2
sget-object v1, Lcom/bugsnag/android/JsonWriter;->REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0xa
const-string v3, "\\n"
aput-object v3, v1, v2
sget-object v1, Lcom/bugsnag/android/JsonWriter;->REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0xd
const-string v3, "\\r"
aput-object v3, v1, v2
sget-object v1, Lcom/bugsnag/android/JsonWriter;->REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0xc
const-string v3, "\\f"
aput-object v3, v1, v2
sget-object v1, Lcom/bugsnag/android/JsonWriter;->REPLACEMENT_CHARS:[Ljava/lang/String;
invoke-virtual {v1}, [Ljava/lang/String;->clone()Ljava/lang/Object;
move-result-object v1
check-cast v1, [Ljava/lang/String;
sput-object v1, Lcom/bugsnag/android/JsonWriter;->HTML_SAFE_REPLACEMENT_CHARS:[Ljava/lang/String;
sget-object v1, Lcom/bugsnag/android/JsonWriter;->HTML_SAFE_REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0x3c
const-string v3, "\\u003c"
aput-object v3, v1, v2
sget-object v1, Lcom/bugsnag/android/JsonWriter;->HTML_SAFE_REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0x3e
const-string v3, "\\u003e"
aput-object v3, v1, v2
sget-object v1, Lcom/bugsnag/android/JsonWriter;->HTML_SAFE_REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0x26
const-string v3, "\\u0026"
aput-object v3, v1, v2
sget-object v1, Lcom/bugsnag/android/JsonWriter;->HTML_SAFE_REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0x3d
const-string v3, "\\u003d"
aput-object v3, v1, v2
sget-object v1, Lcom/bugsnag/android/JsonWriter;->HTML_SAFE_REPLACEMENT_CHARS:[Ljava/lang/String;
const/16 v2, 0x27
const-string v3, "\\u0027"
aput-object v3, v1, v2
return-void
.end method
.method public constructor <init>(Ljava/io/Writer;)V
.locals 2
.param p1, "out" # Ljava/io/Writer;
.prologue
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
iput-object v0, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
sget-object v1, Lcom/bugsnag/android/JsonWriter$JsonScope;->EMPTY_DOCUMENT:Lcom/bugsnag/android/JsonWriter$JsonScope;
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
const-string v0, ":"
iput-object v0, p0, Lcom/bugsnag/android/JsonWriter;->separator:Ljava/lang/String;
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/bugsnag/android/JsonWriter;->serializeNulls:Z
if-nez p1, :cond_0
new-instance v0, Ljava/lang/NullPointerException;
const-string v1, "out == null"
invoke-direct {v0, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
throw v0
:cond_0
iput-object p1, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
return-void
.end method
.method private beforeName()V
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->peek()Lcom/bugsnag/android/JsonWriter$JsonScope;
move-result-object v0
.local v0, "context":Lcom/bugsnag/android/JsonWriter$JsonScope;
sget-object v1, Lcom/bugsnag/android/JsonWriter$JsonScope;->NONEMPTY_OBJECT:Lcom/bugsnag/android/JsonWriter$JsonScope;
if-ne v0, v1, :cond_1
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
const/16 v2, 0x2c
invoke-virtual {v1, v2}, Ljava/io/Writer;->write(I)V
:cond_0
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->newline()V
sget-object v1, Lcom/bugsnag/android/JsonWriter$JsonScope;->DANGLING_NAME:Lcom/bugsnag/android/JsonWriter$JsonScope;
invoke-direct {p0, v1}, Lcom/bugsnag/android/JsonWriter;->replaceTop(Lcom/bugsnag/android/JsonWriter$JsonScope;)V
return-void
:cond_1
sget-object v1, Lcom/bugsnag/android/JsonWriter$JsonScope;->EMPTY_OBJECT:Lcom/bugsnag/android/JsonWriter$JsonScope;
if-eq v0, v1, :cond_0
new-instance v1, Ljava/lang/IllegalStateException;
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "Nesting problem: "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
iget-object v3, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-direct {v1, v2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v1
.end method
.method private beforeValue(Z)V
.locals 3
.param p1, "root" # Z
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
sget-object v0, Lcom/bugsnag/android/JsonWriter$1;->$SwitchMap$com$bugsnag$android$JsonWriter$JsonScope:[I
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->peek()Lcom/bugsnag/android/JsonWriter$JsonScope;
move-result-object v1
invoke-virtual {v1}, Lcom/bugsnag/android/JsonWriter$JsonScope;->ordinal()I
move-result v1
aget v0, v0, v1
packed-switch v0, :pswitch_data_0
new-instance v0, Ljava/lang/IllegalStateException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Nesting problem: "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget-object v2, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:pswitch_0
iget-boolean v0, p0, Lcom/bugsnag/android/JsonWriter;->lenient:Z
if-nez v0, :cond_0
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "JSON must have only one top-level value."
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:cond_0
:pswitch_1
iget-boolean v0, p0, Lcom/bugsnag/android/JsonWriter;->lenient:Z
if-nez v0, :cond_1
if-nez p1, :cond_1
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "JSON must start with an array or an object."
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:cond_1
sget-object v0, Lcom/bugsnag/android/JsonWriter$JsonScope;->NONEMPTY_DOCUMENT:Lcom/bugsnag/android/JsonWriter$JsonScope;
invoke-direct {p0, v0}, Lcom/bugsnag/android/JsonWriter;->replaceTop(Lcom/bugsnag/android/JsonWriter$JsonScope;)V
:goto_0
return-void
:pswitch_2
sget-object v0, Lcom/bugsnag/android/JsonWriter$JsonScope;->NONEMPTY_ARRAY:Lcom/bugsnag/android/JsonWriter$JsonScope;
invoke-direct {p0, v0}, Lcom/bugsnag/android/JsonWriter;->replaceTop(Lcom/bugsnag/android/JsonWriter$JsonScope;)V
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->newline()V
goto :goto_0
:pswitch_3
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
const/16 v1, 0x2c
invoke-virtual {v0, v1}, Ljava/io/Writer;->append(C)Ljava/io/Writer;
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->newline()V
goto :goto_0
:pswitch_4
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->separator:Ljava/lang/String;
invoke-virtual {v0, v1}, Ljava/io/Writer;->append(Ljava/lang/CharSequence;)Ljava/io/Writer;
sget-object v0, Lcom/bugsnag/android/JsonWriter$JsonScope;->NONEMPTY_OBJECT:Lcom/bugsnag/android/JsonWriter$JsonScope;
invoke-direct {p0, v0}, Lcom/bugsnag/android/JsonWriter;->replaceTop(Lcom/bugsnag/android/JsonWriter$JsonScope;)V
goto :goto_0
nop
:pswitch_data_0
.packed-switch 0x1
:pswitch_0
:pswitch_1
:pswitch_2
:pswitch_3
:pswitch_4
.end packed-switch
.end method
.method private close(Lcom/bugsnag/android/JsonWriter$JsonScope;Lcom/bugsnag/android/JsonWriter$JsonScope;Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
.locals 4
.param p1, "empty" # Lcom/bugsnag/android/JsonWriter$JsonScope;
.param p2, "nonempty" # Lcom/bugsnag/android/JsonWriter$JsonScope;
.param p3, "closeBracket" # Ljava/lang/String;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->peek()Lcom/bugsnag/android/JsonWriter$JsonScope;
move-result-object v0
.local v0, "context":Lcom/bugsnag/android/JsonWriter$JsonScope;
if-eq v0, p2, :cond_0
if-eq v0, p1, :cond_0
new-instance v1, Ljava/lang/IllegalStateException;
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "Nesting problem: "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
iget-object v3, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-direct {v1, v2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v1
:cond_0
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->deferredName:Ljava/lang/String;
if-eqz v1, :cond_1
new-instance v1, Ljava/lang/IllegalStateException;
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "Dangling name: "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
iget-object v3, p0, Lcom/bugsnag/android/JsonWriter;->deferredName:Ljava/lang/String;
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-direct {v1, v2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v1
:cond_1
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
iget-object v2, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-interface {v2}, Ljava/util/List;->size()I
move-result v2
add-int/lit8 v2, v2, -0x1
invoke-interface {v1, v2}, Ljava/util/List;->remove(I)Ljava/lang/Object;
if-ne v0, p2, :cond_2
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->newline()V
:cond_2
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
invoke-virtual {v1, p3}, Ljava/io/Writer;->write(Ljava/lang/String;)V
return-object p0
.end method
.method private newline()V
.locals 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->indent:Ljava/lang/String;
if-nez v1, :cond_1
:cond_0
return-void
:cond_1
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
const-string v2, "\n"
invoke-virtual {v1, v2}, Ljava/io/Writer;->write(Ljava/lang/String;)V
const/4 v0, 0x1
.local v0, "i":I
:goto_0
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v1
if-ge v0, v1, :cond_0
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
iget-object v2, p0, Lcom/bugsnag/android/JsonWriter;->indent:Ljava/lang/String;
invoke-virtual {v1, v2}, Ljava/io/Writer;->write(Ljava/lang/String;)V
add-int/lit8 v0, v0, 0x1
goto :goto_0
.end method
.method private open(Lcom/bugsnag/android/JsonWriter$JsonScope;Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
.locals 1
.param p1, "empty" # Lcom/bugsnag/android/JsonWriter$JsonScope;
.param p2, "openBracket" # Ljava/lang/String;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
const/4 v0, 0x1
invoke-direct {p0, v0}, Lcom/bugsnag/android/JsonWriter;->beforeValue(Z)V
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
invoke-virtual {v0, p2}, Ljava/io/Writer;->write(Ljava/lang/String;)V
return-object p0
.end method
.method private peek()Lcom/bugsnag/android/JsonWriter$JsonScope;
.locals 3
.prologue
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v0
.local v0, "size":I
if-nez v0, :cond_0
new-instance v1, Ljava/lang/IllegalStateException;
const-string v2, "JsonWriter is closed."
invoke-direct {v1, v2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v1
:cond_0
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
add-int/lit8 v2, v0, -0x1
invoke-interface {v1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v1
check-cast v1, Lcom/bugsnag/android/JsonWriter$JsonScope;
return-object v1
.end method
.method private replaceTop(Lcom/bugsnag/android/JsonWriter$JsonScope;)V
.locals 2
.param p1, "topOfStack" # Lcom/bugsnag/android/JsonWriter$JsonScope;
.prologue
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v1
add-int/lit8 v1, v1, -0x1
invoke-interface {v0, v1, p1}, Ljava/util/List;->set(ILjava/lang/Object;)Ljava/lang/Object;
return-void
.end method
.method private string(Ljava/lang/String;)V
.locals 8
.param p1, "value" # Ljava/lang/String;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
iget-boolean v6, p0, Lcom/bugsnag/android/JsonWriter;->htmlSafe:Z
if-eqz v6, :cond_1
sget-object v5, Lcom/bugsnag/android/JsonWriter;->HTML_SAFE_REPLACEMENT_CHARS:[Ljava/lang/String;
.local v5, "replacements":[Ljava/lang/String;
:goto_0
iget-object v6, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
const-string v7, "\""
invoke-virtual {v6, v7}, Ljava/io/Writer;->write(Ljava/lang/String;)V
const/4 v2, 0x0
.local v2, "last":I
invoke-virtual {p1}, Ljava/lang/String;->length()I
move-result v3
.local v3, "length":I
const/4 v1, 0x0
.local v1, "i":I
:goto_1
if-ge v1, v3, :cond_6
invoke-virtual {p1, v1}, Ljava/lang/String;->charAt(I)C
move-result v0
.local v0, "c":C
const/16 v6, 0x80
if-ge v0, v6, :cond_2
aget-object v4, v5, v0
.local v4, "replacement":Ljava/lang/String;
if-nez v4, :cond_3
.end local v4 # "replacement":Ljava/lang/String;
:cond_0
:goto_2
add-int/lit8 v1, v1, 0x1
goto :goto_1
.end local v0 # "c":C
.end local v1 # "i":I
.end local v2 # "last":I
.end local v3 # "length":I
.end local v5 # "replacements":[Ljava/lang/String;
:cond_1
sget-object v5, Lcom/bugsnag/android/JsonWriter;->REPLACEMENT_CHARS:[Ljava/lang/String;
goto :goto_0
.restart local v0 # "c":C
.restart local v1 # "i":I
.restart local v2 # "last":I
.restart local v3 # "length":I
.restart local v5 # "replacements":[Ljava/lang/String;
:cond_2
const/16 v6, 0x2028
if-ne v0, v6, :cond_5
const-string v4, "\\u2028"
.restart local v4 # "replacement":Ljava/lang/String;
:cond_3
:goto_3
if-ge v2, v1, :cond_4
iget-object v6, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
sub-int v7, v1, v2
invoke-virtual {v6, p1, v2, v7}, Ljava/io/Writer;->write(Ljava/lang/String;II)V
:cond_4
iget-object v6, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
invoke-virtual {v6, v4}, Ljava/io/Writer;->write(Ljava/lang/String;)V
add-int/lit8 v2, v1, 0x1
goto :goto_2
.end local v4 # "replacement":Ljava/lang/String;
:cond_5
const/16 v6, 0x2029
if-ne v0, v6, :cond_0
const-string v4, "\\u2029"
.restart local v4 # "replacement":Ljava/lang/String;
goto :goto_3
.end local v0 # "c":C
.end local v4 # "replacement":Ljava/lang/String;
:cond_6
if-ge v2, v3, :cond_7
iget-object v6, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
sub-int v7, v3, v2
invoke-virtual {v6, p1, v2, v7}, Ljava/io/Writer;->write(Ljava/lang/String;II)V
:cond_7
iget-object v6, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
const-string v7, "\""
invoke-virtual {v6, v7}, Ljava/io/Writer;->write(Ljava/lang/String;)V
return-void
.end method
.method private writeDeferredName()V
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->deferredName:Ljava/lang/String;
if-eqz v0, :cond_0
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->beforeName()V
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->deferredName:Ljava/lang/String;
invoke-direct {p0, v0}, Lcom/bugsnag/android/JsonWriter;->string(Ljava/lang/String;)V
const/4 v0, 0x0
iput-object v0, p0, Lcom/bugsnag/android/JsonWriter;->deferredName:Ljava/lang/String;
:cond_0
return-void
.end method
# virtual methods
.method public beginArray()Lcom/bugsnag/android/JsonWriter;
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->writeDeferredName()V
sget-object v0, Lcom/bugsnag/android/JsonWriter$JsonScope;->EMPTY_ARRAY:Lcom/bugsnag/android/JsonWriter$JsonScope;
const-string v1, "["
invoke-direct {p0, v0, v1}, Lcom/bugsnag/android/JsonWriter;->open(Lcom/bugsnag/android/JsonWriter$JsonScope;Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
move-result-object v0
return-object v0
.end method
.method public beginObject()Lcom/bugsnag/android/JsonWriter;
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->writeDeferredName()V
sget-object v0, Lcom/bugsnag/android/JsonWriter$JsonScope;->EMPTY_OBJECT:Lcom/bugsnag/android/JsonWriter$JsonScope;
const-string v1, "{"
invoke-direct {p0, v0, v1}, Lcom/bugsnag/android/JsonWriter;->open(Lcom/bugsnag/android/JsonWriter$JsonScope;Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
move-result-object v0
return-object v0
.end method
.method public close()V
.locals 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
const/4 v2, 0x1
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
invoke-virtual {v1}, Ljava/io/Writer;->close()V
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v0
.local v0, "size":I
if-gt v0, v2, :cond_0
if-ne v0, v2, :cond_1
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
add-int/lit8 v2, v0, -0x1
invoke-interface {v1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v1
sget-object v2, Lcom/bugsnag/android/JsonWriter$JsonScope;->NONEMPTY_DOCUMENT:Lcom/bugsnag/android/JsonWriter$JsonScope;
if-eq v1, v2, :cond_1
:cond_0
new-instance v1, Ljava/io/IOException;
const-string v2, "Incomplete document"
invoke-direct {v1, v2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v1
:cond_1
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-interface {v1}, Ljava/util/List;->clear()V
return-void
.end method
.method public endArray()Lcom/bugsnag/android/JsonWriter;
.locals 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
sget-object v0, Lcom/bugsnag/android/JsonWriter$JsonScope;->EMPTY_ARRAY:Lcom/bugsnag/android/JsonWriter$JsonScope;
sget-object v1, Lcom/bugsnag/android/JsonWriter$JsonScope;->NONEMPTY_ARRAY:Lcom/bugsnag/android/JsonWriter$JsonScope;
const-string v2, "]"
invoke-direct {p0, v0, v1, v2}, Lcom/bugsnag/android/JsonWriter;->close(Lcom/bugsnag/android/JsonWriter$JsonScope;Lcom/bugsnag/android/JsonWriter$JsonScope;Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
move-result-object v0
return-object v0
.end method
.method public endObject()Lcom/bugsnag/android/JsonWriter;
.locals 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
sget-object v0, Lcom/bugsnag/android/JsonWriter$JsonScope;->EMPTY_OBJECT:Lcom/bugsnag/android/JsonWriter$JsonScope;
sget-object v1, Lcom/bugsnag/android/JsonWriter$JsonScope;->NONEMPTY_OBJECT:Lcom/bugsnag/android/JsonWriter$JsonScope;
const-string v2, "}"
invoke-direct {p0, v0, v1, v2}, Lcom/bugsnag/android/JsonWriter;->close(Lcom/bugsnag/android/JsonWriter$JsonScope;Lcom/bugsnag/android/JsonWriter$JsonScope;Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
move-result-object v0
return-object v0
.end method
.method public flush()V
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
move-result v0
if-eqz v0, :cond_0
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "JsonWriter is closed."
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:cond_0
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
invoke-virtual {v0}, Ljava/io/Writer;->flush()V
return-void
.end method
.method public final getSerializeNulls()Z
.locals 1
.prologue
iget-boolean v0, p0, Lcom/bugsnag/android/JsonWriter;->serializeNulls:Z
return v0
.end method
.method public final isHtmlSafe()Z
.locals 1
.prologue
iget-boolean v0, p0, Lcom/bugsnag/android/JsonWriter;->htmlSafe:Z
return v0
.end method
.method public isLenient()Z
.locals 1
.prologue
iget-boolean v0, p0, Lcom/bugsnag/android/JsonWriter;->lenient:Z
return v0
.end method
.method public name(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
.locals 2
.param p1, "name" # Ljava/lang/String;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
if-nez p1, :cond_0
new-instance v0, Ljava/lang/NullPointerException;
const-string v1, "name == null"
invoke-direct {v0, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
throw v0
:cond_0
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->deferredName:Ljava/lang/String;
if-eqz v0, :cond_1
new-instance v0, Ljava/lang/IllegalStateException;
invoke-direct {v0}, Ljava/lang/IllegalStateException;-><init>()V
throw v0
:cond_1
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->stack:Ljava/util/List;
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
move-result v0
if-eqz v0, :cond_2
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "JsonWriter is closed."
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:cond_2
iput-object p1, p0, Lcom/bugsnag/android/JsonWriter;->deferredName:Ljava/lang/String;
return-object p0
.end method
.method public nullValue()Lcom/bugsnag/android/JsonWriter;
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->deferredName:Ljava/lang/String;
if-eqz v0, :cond_0
iget-boolean v0, p0, Lcom/bugsnag/android/JsonWriter;->serializeNulls:Z
if-eqz v0, :cond_1
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->writeDeferredName()V
:cond_0
const/4 v0, 0x0
invoke-direct {p0, v0}, Lcom/bugsnag/android/JsonWriter;->beforeValue(Z)V
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
const-string v1, "null"
invoke-virtual {v0, v1}, Ljava/io/Writer;->write(Ljava/lang/String;)V
:goto_0
return-object p0
:cond_1
const/4 v0, 0x0
iput-object v0, p0, Lcom/bugsnag/android/JsonWriter;->deferredName:Ljava/lang/String;
goto :goto_0
.end method
.method public final setHtmlSafe(Z)V
.locals 0
.param p1, "htmlSafe" # Z
.prologue
iput-boolean p1, p0, Lcom/bugsnag/android/JsonWriter;->htmlSafe:Z
return-void
.end method
.method public final setIndent(Ljava/lang/String;)V
.locals 1
.param p1, "indent" # Ljava/lang/String;
.prologue
invoke-virtual {p1}, Ljava/lang/String;->length()I
move-result v0
if-nez v0, :cond_0
const/4 v0, 0x0
iput-object v0, p0, Lcom/bugsnag/android/JsonWriter;->indent:Ljava/lang/String;
const-string v0, ":"
iput-object v0, p0, Lcom/bugsnag/android/JsonWriter;->separator:Ljava/lang/String;
:goto_0
return-void
:cond_0
iput-object p1, p0, Lcom/bugsnag/android/JsonWriter;->indent:Ljava/lang/String;
const-string v0, ": "
iput-object v0, p0, Lcom/bugsnag/android/JsonWriter;->separator:Ljava/lang/String;
goto :goto_0
.end method
.method public final setLenient(Z)V
.locals 0
.param p1, "lenient" # Z
.prologue
iput-boolean p1, p0, Lcom/bugsnag/android/JsonWriter;->lenient:Z
return-void
.end method
.method public final setSerializeNulls(Z)V
.locals 0
.param p1, "serializeNulls" # Z
.prologue
iput-boolean p1, p0, Lcom/bugsnag/android/JsonWriter;->serializeNulls:Z
return-void
.end method
.method public value(D)Lcom/bugsnag/android/JsonWriter;
.locals 3
.param p1, "value" # D
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
invoke-static {p1, p2}, Ljava/lang/Double;->isNaN(D)Z
move-result v0
if-nez v0, :cond_0
invoke-static {p1, p2}, Ljava/lang/Double;->isInfinite(D)Z
move-result v0
if-eqz v0, :cond_1
:cond_0
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Numeric values must be finite, but was "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, p1, p2}, Ljava/lang/StringBuilder;->append(D)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
:cond_1
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->writeDeferredName()V
const/4 v0, 0x0
invoke-direct {p0, v0}, Lcom/bugsnag/android/JsonWriter;->beforeValue(Z)V
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
invoke-static {p1, p2}, Ljava/lang/Double;->toString(D)Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/io/Writer;->append(Ljava/lang/CharSequence;)Ljava/io/Writer;
return-object p0
.end method
.method public value(J)Lcom/bugsnag/android/JsonWriter;
.locals 3
.param p1, "value" # J
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->writeDeferredName()V
const/4 v0, 0x0
invoke-direct {p0, v0}, Lcom/bugsnag/android/JsonWriter;->beforeValue(Z)V
iget-object v0, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
invoke-static {p1, p2}, Ljava/lang/Long;->toString(J)Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/io/Writer;->write(Ljava/lang/String;)V
return-object p0
.end method
.method public value(Ljava/lang/Number;)Lcom/bugsnag/android/JsonWriter;
.locals 4
.param p1, "value" # Ljava/lang/Number;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
if-nez p1, :cond_0
invoke-virtual {p0}, Lcom/bugsnag/android/JsonWriter;->nullValue()Lcom/bugsnag/android/JsonWriter;
move-result-object p0
.end local p0 # "this":Lcom/bugsnag/android/JsonWriter;
:goto_0
return-object p0
.restart local p0 # "this":Lcom/bugsnag/android/JsonWriter;
:cond_0
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->writeDeferredName()V
invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v0
.local v0, "string":Ljava/lang/String;
iget-boolean v1, p0, Lcom/bugsnag/android/JsonWriter;->lenient:Z
if-nez v1, :cond_2
const-string v1, "-Infinity"
invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-nez v1, :cond_1
const-string v1, "Infinity"
invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-nez v1, :cond_1
const-string v1, "NaN"
invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_2
:cond_1
new-instance v1, Ljava/lang/IllegalArgumentException;
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "Numeric values must be finite, but was "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v1
:cond_2
const/4 v1, 0x0
invoke-direct {p0, v1}, Lcom/bugsnag/android/JsonWriter;->beforeValue(Z)V
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
invoke-virtual {v1, v0}, Ljava/io/Writer;->append(Ljava/lang/CharSequence;)Ljava/io/Writer;
goto :goto_0
.end method
.method public value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
.locals 1
.param p1, "value" # Ljava/lang/String;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
if-nez p1, :cond_0
invoke-virtual {p0}, Lcom/bugsnag/android/JsonWriter;->nullValue()Lcom/bugsnag/android/JsonWriter;
move-result-object p0
.end local p0 # "this":Lcom/bugsnag/android/JsonWriter;
:goto_0
return-object p0
.restart local p0 # "this":Lcom/bugsnag/android/JsonWriter;
:cond_0
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->writeDeferredName()V
const/4 v0, 0x0
invoke-direct {p0, v0}, Lcom/bugsnag/android/JsonWriter;->beforeValue(Z)V
invoke-direct {p0, p1}, Lcom/bugsnag/android/JsonWriter;->string(Ljava/lang/String;)V
goto :goto_0
.end method
.method public value(Z)Lcom/bugsnag/android/JsonWriter;
.locals 2
.param p1, "value" # Z
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
invoke-direct {p0}, Lcom/bugsnag/android/JsonWriter;->writeDeferredName()V
const/4 v0, 0x0
invoke-direct {p0, v0}, Lcom/bugsnag/android/JsonWriter;->beforeValue(Z)V
iget-object v1, p0, Lcom/bugsnag/android/JsonWriter;->out:Ljava/io/Writer;
if-eqz p1, :cond_0
const-string v0, "true"
:goto_0
invoke-virtual {v1, v0}, Ljava/io/Writer;->write(Ljava/lang/String;)V
return-object p0
:cond_0
const-string v0, "false"
goto :goto_0
.end method