123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692 |
- .class public final Lcom/google/gson/internal/bind/JsonTreeWriter;
- .super Lcom/google/gson/stream/JsonWriter;
- .source ""
- # static fields
- .field private static final SENTINEL_CLOSED:Lcom/google/gson/JsonPrimitive;
- .field private static final UNWRITABLE_WRITER:Ljava/io/Writer;
- # instance fields
- .field private pendingName:Ljava/lang/String;
- .field private product:Lcom/google/gson/JsonElement;
- .field private final stack:Ljava/util/List;
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "Ljava/util/List<",
- "Lcom/google/gson/JsonElement;",
- ">;"
- }
- .end annotation
- .end field
- # direct methods
- .method static constructor <clinit>()V
- .locals 2
- new-instance v0, Lcom/google/gson/internal/bind/JsonTreeWriter$1;
- invoke-direct {v0}, Lcom/google/gson/internal/bind/JsonTreeWriter$1;-><init>()V
- sput-object v0, Lcom/google/gson/internal/bind/JsonTreeWriter;->UNWRITABLE_WRITER:Ljava/io/Writer;
- new-instance v0, Lcom/google/gson/JsonPrimitive;
- const-string v1, "closed"
- invoke-direct {v0, v1}, Lcom/google/gson/JsonPrimitive;-><init>(Ljava/lang/String;)V
- sput-object v0, Lcom/google/gson/internal/bind/JsonTreeWriter;->SENTINEL_CLOSED:Lcom/google/gson/JsonPrimitive;
- return-void
- .end method
- .method public constructor <init>()V
- .locals 1
- sget-object v0, Lcom/google/gson/internal/bind/JsonTreeWriter;->UNWRITABLE_WRITER:Ljava/io/Writer;
- invoke-direct {p0, v0}, Lcom/google/gson/stream/JsonWriter;-><init>(Ljava/io/Writer;)V
- new-instance v0, Ljava/util/ArrayList;
- invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
- iput-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- sget-object v0, Lcom/google/gson/JsonNull;->INSTANCE:Lcom/google/gson/JsonNull;
- iput-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->product:Lcom/google/gson/JsonElement;
- return-void
- .end method
- .method private peek()Lcom/google/gson/JsonElement;
- .locals 2
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-interface {v0}, Ljava/util/List;->size()I
- move-result v1
- add-int/lit8 v1, v1, -0x1
- invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
- move-result-object v0
- check-cast v0, Lcom/google/gson/JsonElement;
- return-object v0
- .end method
- .method private put(Lcom/google/gson/JsonElement;)V
- .locals 2
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->pendingName:Ljava/lang/String;
- if-eqz v0, :cond_2
- invoke-virtual {p1}, Lcom/google/gson/JsonElement;->isJsonNull()Z
- move-result v0
- if-eqz v0, :cond_0
- invoke-virtual {p0}, Lcom/google/gson/stream/JsonWriter;->getSerializeNulls()Z
- move-result v0
- if-eqz v0, :cond_1
- :cond_0
- invoke-direct {p0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->peek()Lcom/google/gson/JsonElement;
- move-result-object v0
- check-cast v0, Lcom/google/gson/JsonObject;
- iget-object v1, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->pendingName:Ljava/lang/String;
- invoke-virtual {v0, v1, p1}, Lcom/google/gson/JsonObject;->add(Ljava/lang/String;Lcom/google/gson/JsonElement;)V
- :cond_1
- const/4 p1, 0x0
- iput-object p1, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->pendingName:Ljava/lang/String;
- goto :goto_0
- :cond_2
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
- move-result v0
- if-eqz v0, :cond_3
- iput-object p1, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->product:Lcom/google/gson/JsonElement;
- goto :goto_0
- :cond_3
- invoke-direct {p0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->peek()Lcom/google/gson/JsonElement;
- move-result-object v0
- instance-of v1, v0, Lcom/google/gson/JsonArray;
- if-eqz v1, :cond_4
- check-cast v0, Lcom/google/gson/JsonArray;
- invoke-virtual {v0, p1}, Lcom/google/gson/JsonArray;->add(Lcom/google/gson/JsonElement;)V
- :goto_0
- return-void
- :cond_4
- new-instance p1, Ljava/lang/IllegalStateException;
- invoke-direct {p1}, Ljava/lang/IllegalStateException;-><init>()V
- throw p1
- .end method
- # virtual methods
- .method public beginArray()Lcom/google/gson/stream/JsonWriter;
- .locals 2
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- new-instance v0, Lcom/google/gson/JsonArray;
- invoke-direct {v0}, Lcom/google/gson/JsonArray;-><init>()V
- invoke-direct {p0, v0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->put(Lcom/google/gson/JsonElement;)V
- iget-object v1, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-interface {v1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
- return-object p0
- .end method
- .method public beginObject()Lcom/google/gson/stream/JsonWriter;
- .locals 2
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- new-instance v0, Lcom/google/gson/JsonObject;
- invoke-direct {v0}, Lcom/google/gson/JsonObject;-><init>()V
- invoke-direct {p0, v0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->put(Lcom/google/gson/JsonElement;)V
- iget-object v1, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-interface {v1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
- return-object p0
- .end method
- .method public close()V
- .locals 2
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
- move-result v0
- if-eqz v0, :cond_0
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- sget-object v1, Lcom/google/gson/internal/bind/JsonTreeWriter;->SENTINEL_CLOSED:Lcom/google/gson/JsonPrimitive;
- invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
- return-void
- :cond_0
- new-instance v0, Ljava/io/IOException;
- const-string v1, "Incomplete document"
- invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
- throw v0
- .end method
- .method public endArray()Lcom/google/gson/stream/JsonWriter;
- .locals 2
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
- move-result v0
- if-nez v0, :cond_1
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->pendingName:Ljava/lang/String;
- if-nez v0, :cond_1
- invoke-direct {p0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->peek()Lcom/google/gson/JsonElement;
- move-result-object v0
- instance-of v0, v0, Lcom/google/gson/JsonArray;
- if-eqz v0, :cond_0
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-interface {v0}, Ljava/util/List;->size()I
- move-result v1
- add-int/lit8 v1, v1, -0x1
- invoke-interface {v0, v1}, Ljava/util/List;->remove(I)Ljava/lang/Object;
- return-object p0
- :cond_0
- new-instance v0, Ljava/lang/IllegalStateException;
- invoke-direct {v0}, Ljava/lang/IllegalStateException;-><init>()V
- throw v0
- :cond_1
- new-instance v0, Ljava/lang/IllegalStateException;
- invoke-direct {v0}, Ljava/lang/IllegalStateException;-><init>()V
- throw v0
- .end method
- .method public endObject()Lcom/google/gson/stream/JsonWriter;
- .locals 2
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
- move-result v0
- if-nez v0, :cond_1
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->pendingName:Ljava/lang/String;
- if-nez v0, :cond_1
- invoke-direct {p0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->peek()Lcom/google/gson/JsonElement;
- move-result-object v0
- instance-of v0, v0, Lcom/google/gson/JsonObject;
- if-eqz v0, :cond_0
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-interface {v0}, Ljava/util/List;->size()I
- move-result v1
- add-int/lit8 v1, v1, -0x1
- invoke-interface {v0, v1}, Ljava/util/List;->remove(I)Ljava/lang/Object;
- return-object p0
- :cond_0
- new-instance v0, Ljava/lang/IllegalStateException;
- invoke-direct {v0}, Ljava/lang/IllegalStateException;-><init>()V
- throw v0
- :cond_1
- new-instance v0, Ljava/lang/IllegalStateException;
- invoke-direct {v0}, Ljava/lang/IllegalStateException;-><init>()V
- throw v0
- .end method
- .method public flush()V
- .locals 0
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- return-void
- .end method
- .method public get()Lcom/google/gson/JsonElement;
- .locals 3
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
- move-result v0
- if-eqz v0, :cond_0
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->product:Lcom/google/gson/JsonElement;
- return-object v0
- :cond_0
- new-instance v0, Ljava/lang/IllegalStateException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- const-string v2, "Expected one JSON element but was "
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget-object v2, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
- 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
- .end method
- .method public name(Ljava/lang/String;)Lcom/google/gson/stream/JsonWriter;
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->stack:Ljava/util/List;
- invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
- move-result v0
- if-nez v0, :cond_1
- iget-object v0, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->pendingName:Ljava/lang/String;
- if-nez v0, :cond_1
- invoke-direct {p0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->peek()Lcom/google/gson/JsonElement;
- move-result-object v0
- instance-of v0, v0, Lcom/google/gson/JsonObject;
- if-eqz v0, :cond_0
- iput-object p1, p0, Lcom/google/gson/internal/bind/JsonTreeWriter;->pendingName:Ljava/lang/String;
- return-object p0
- :cond_0
- new-instance p1, Ljava/lang/IllegalStateException;
- invoke-direct {p1}, Ljava/lang/IllegalStateException;-><init>()V
- throw p1
- :cond_1
- new-instance p1, Ljava/lang/IllegalStateException;
- invoke-direct {p1}, Ljava/lang/IllegalStateException;-><init>()V
- throw p1
- .end method
- .method public nullValue()Lcom/google/gson/stream/JsonWriter;
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- sget-object v0, Lcom/google/gson/JsonNull;->INSTANCE:Lcom/google/gson/JsonNull;
- invoke-direct {p0, v0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->put(Lcom/google/gson/JsonElement;)V
- return-object p0
- .end method
- .method public value(D)Lcom/google/gson/stream/JsonWriter;
- .locals 3
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- invoke-virtual {p0}, Lcom/google/gson/stream/JsonWriter;->isLenient()Z
- move-result v0
- if-nez v0, :cond_1
- 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-nez v0, :cond_0
- goto :goto_0
- :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, "JSON forbids NaN and infinities: "
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1, p1, p2}, Ljava/lang/StringBuilder;->append(D)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p1
- invoke-direct {v0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
- throw v0
- :cond_1
- :goto_0
- new-instance v0, Lcom/google/gson/JsonPrimitive;
- invoke-static {p1, p2}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;
- move-result-object p1
- invoke-direct {v0, p1}, Lcom/google/gson/JsonPrimitive;-><init>(Ljava/lang/Number;)V
- invoke-direct {p0, v0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->put(Lcom/google/gson/JsonElement;)V
- return-object p0
- .end method
- .method public value(J)Lcom/google/gson/stream/JsonWriter;
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- new-instance v0, Lcom/google/gson/JsonPrimitive;
- invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
- move-result-object p1
- invoke-direct {v0, p1}, Lcom/google/gson/JsonPrimitive;-><init>(Ljava/lang/Number;)V
- invoke-direct {p0, v0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->put(Lcom/google/gson/JsonElement;)V
- return-object p0
- .end method
- .method public value(Ljava/lang/Boolean;)Lcom/google/gson/stream/JsonWriter;
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- if-nez p1, :cond_0
- invoke-virtual {p0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->nullValue()Lcom/google/gson/stream/JsonWriter;
- move-result-object p1
- return-object p1
- :cond_0
- new-instance v0, Lcom/google/gson/JsonPrimitive;
- invoke-direct {v0, p1}, Lcom/google/gson/JsonPrimitive;-><init>(Ljava/lang/Boolean;)V
- invoke-direct {p0, v0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->put(Lcom/google/gson/JsonElement;)V
- return-object p0
- .end method
- .method public value(Ljava/lang/Number;)Lcom/google/gson/stream/JsonWriter;
- .locals 3
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- if-nez p1, :cond_0
- invoke-virtual {p0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->nullValue()Lcom/google/gson/stream/JsonWriter;
- move-result-object p1
- return-object p1
- :cond_0
- invoke-virtual {p0}, Lcom/google/gson/stream/JsonWriter;->isLenient()Z
- move-result v0
- if-nez v0, :cond_2
- invoke-virtual {p1}, Ljava/lang/Number;->doubleValue()D
- move-result-wide v0
- invoke-static {v0, v1}, Ljava/lang/Double;->isNaN(D)Z
- move-result v2
- if-nez v2, :cond_1
- invoke-static {v0, v1}, Ljava/lang/Double;->isInfinite(D)Z
- move-result v0
- if-nez v0, :cond_1
- goto :goto_0
- :cond_1
- new-instance v0, Ljava/lang/IllegalArgumentException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- const-string v2, "JSON forbids NaN and infinities: "
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p1
- invoke-direct {v0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
- throw v0
- :cond_2
- :goto_0
- new-instance v0, Lcom/google/gson/JsonPrimitive;
- invoke-direct {v0, p1}, Lcom/google/gson/JsonPrimitive;-><init>(Ljava/lang/Number;)V
- invoke-direct {p0, v0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->put(Lcom/google/gson/JsonElement;)V
- return-object p0
- .end method
- .method public value(Ljava/lang/String;)Lcom/google/gson/stream/JsonWriter;
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- if-nez p1, :cond_0
- invoke-virtual {p0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->nullValue()Lcom/google/gson/stream/JsonWriter;
- move-result-object p1
- return-object p1
- :cond_0
- new-instance v0, Lcom/google/gson/JsonPrimitive;
- invoke-direct {v0, p1}, Lcom/google/gson/JsonPrimitive;-><init>(Ljava/lang/String;)V
- invoke-direct {p0, v0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->put(Lcom/google/gson/JsonElement;)V
- return-object p0
- .end method
- .method public value(Z)Lcom/google/gson/stream/JsonWriter;
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- new-instance v0, Lcom/google/gson/JsonPrimitive;
- invoke-static {p1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
- move-result-object p1
- invoke-direct {v0, p1}, Lcom/google/gson/JsonPrimitive;-><init>(Ljava/lang/Boolean;)V
- invoke-direct {p0, v0}, Lcom/google/gson/internal/bind/JsonTreeWriter;->put(Lcom/google/gson/JsonElement;)V
- return-object p0
- .end method
|