JsonStreamParser.smali 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. .class public final Lcom/google/gson/JsonStreamParser;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Ljava/util/Iterator;
  6. # annotations
  7. .annotation system Ldalvik/annotation/Signature;
  8. value = {
  9. "Ljava/lang/Object;",
  10. "Ljava/util/Iterator<",
  11. "Lcom/google/gson/JsonElement;",
  12. ">;"
  13. }
  14. .end annotation
  15. # instance fields
  16. .field private final lock:Ljava/lang/Object;
  17. .field private final parser:Lcom/google/gson/stream/JsonReader;
  18. # direct methods
  19. .method public constructor <init>(Ljava/io/Reader;)V
  20. .locals 1
  21. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  22. new-instance v0, Lcom/google/gson/stream/JsonReader;
  23. invoke-direct {v0, p1}, Lcom/google/gson/stream/JsonReader;-><init>(Ljava/io/Reader;)V
  24. iput-object v0, p0, Lcom/google/gson/JsonStreamParser;->parser:Lcom/google/gson/stream/JsonReader;
  25. iget-object p1, p0, Lcom/google/gson/JsonStreamParser;->parser:Lcom/google/gson/stream/JsonReader;
  26. const/4 v0, 0x1
  27. invoke-virtual {p1, v0}, Lcom/google/gson/stream/JsonReader;->setLenient(Z)V
  28. new-instance p1, Ljava/lang/Object;
  29. invoke-direct {p1}, Ljava/lang/Object;-><init>()V
  30. iput-object p1, p0, Lcom/google/gson/JsonStreamParser;->lock:Ljava/lang/Object;
  31. return-void
  32. .end method
  33. .method public constructor <init>(Ljava/lang/String;)V
  34. .locals 1
  35. new-instance v0, Ljava/io/StringReader;
  36. invoke-direct {v0, p1}, Ljava/io/StringReader;-><init>(Ljava/lang/String;)V
  37. invoke-direct {p0, v0}, Lcom/google/gson/JsonStreamParser;-><init>(Ljava/io/Reader;)V
  38. return-void
  39. .end method
  40. # virtual methods
  41. .method public hasNext()Z
  42. .locals 3
  43. iget-object v0, p0, Lcom/google/gson/JsonStreamParser;->lock:Ljava/lang/Object;
  44. monitor-enter v0
  45. :try_start_0
  46. iget-object v1, p0, Lcom/google/gson/JsonStreamParser;->parser:Lcom/google/gson/stream/JsonReader;
  47. invoke-virtual {v1}, Lcom/google/gson/stream/JsonReader;->peek()Lcom/google/gson/stream/JsonToken;
  48. move-result-object v1
  49. sget-object v2, Lcom/google/gson/stream/JsonToken;->END_DOCUMENT:Lcom/google/gson/stream/JsonToken;
  50. :try_end_0
  51. .catch Lcom/google/gson/stream/MalformedJsonException; {:try_start_0 .. :try_end_0} :catch_1
  52. .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
  53. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  54. if-eq v1, v2, :cond_0
  55. const/4 v1, 0x1
  56. goto :goto_0
  57. :cond_0
  58. const/4 v1, 0x0
  59. :goto_0
  60. :try_start_1
  61. monitor-exit v0
  62. return v1
  63. :catchall_0
  64. move-exception v1
  65. goto :goto_1
  66. :catch_0
  67. move-exception v1
  68. new-instance v2, Lcom/google/gson/JsonIOException;
  69. invoke-direct {v2, v1}, Lcom/google/gson/JsonIOException;-><init>(Ljava/lang/Throwable;)V
  70. throw v2
  71. :catch_1
  72. move-exception v1
  73. new-instance v2, Lcom/google/gson/JsonSyntaxException;
  74. invoke-direct {v2, v1}, Lcom/google/gson/JsonSyntaxException;-><init>(Ljava/lang/Throwable;)V
  75. throw v2
  76. :goto_1
  77. monitor-exit v0
  78. :try_end_1
  79. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  80. throw v1
  81. .end method
  82. .method public next()Lcom/google/gson/JsonElement;
  83. .locals 3
  84. .annotation system Ldalvik/annotation/Throws;
  85. value = {
  86. Lcom/google/gson/JsonParseException;
  87. }
  88. .end annotation
  89. const-string v0, "Failed parsing JSON source to Json"
  90. invoke-virtual {p0}, Lcom/google/gson/JsonStreamParser;->hasNext()Z
  91. move-result v1
  92. if-eqz v1, :cond_1
  93. :try_start_0
  94. iget-object v1, p0, Lcom/google/gson/JsonStreamParser;->parser:Lcom/google/gson/stream/JsonReader;
  95. invoke-static {v1}, Lcom/google/gson/internal/Streams;->parse(Lcom/google/gson/stream/JsonReader;)Lcom/google/gson/JsonElement;
  96. move-result-object v0
  97. :try_end_0
  98. .catch Ljava/lang/StackOverflowError; {:try_start_0 .. :try_end_0} :catch_2
  99. .catch Ljava/lang/OutOfMemoryError; {:try_start_0 .. :try_end_0} :catch_1
  100. .catch Lcom/google/gson/JsonParseException; {:try_start_0 .. :try_end_0} :catch_0
  101. return-object v0
  102. :catch_0
  103. move-exception v0
  104. invoke-virtual {v0}, Ljava/lang/RuntimeException;->getCause()Ljava/lang/Throwable;
  105. move-result-object v1
  106. instance-of v1, v1, Ljava/io/EOFException;
  107. if-eqz v1, :cond_0
  108. new-instance v0, Ljava/util/NoSuchElementException;
  109. invoke-direct {v0}, Ljava/util/NoSuchElementException;-><init>()V
  110. :cond_0
  111. throw v0
  112. :catch_1
  113. move-exception v1
  114. new-instance v2, Lcom/google/gson/JsonParseException;
  115. invoke-direct {v2, v0, v1}, Lcom/google/gson/JsonParseException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
  116. throw v2
  117. :catch_2
  118. move-exception v1
  119. new-instance v2, Lcom/google/gson/JsonParseException;
  120. invoke-direct {v2, v0, v1}, Lcom/google/gson/JsonParseException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
  121. throw v2
  122. :cond_1
  123. new-instance v0, Ljava/util/NoSuchElementException;
  124. invoke-direct {v0}, Ljava/util/NoSuchElementException;-><init>()V
  125. throw v0
  126. .end method
  127. .method public bridge synthetic next()Ljava/lang/Object;
  128. .locals 1
  129. invoke-virtual {p0}, Lcom/google/gson/JsonStreamParser;->next()Lcom/google/gson/JsonElement;
  130. move-result-object v0
  131. return-object v0
  132. .end method
  133. .method public remove()V
  134. .locals 1
  135. new-instance v0, Ljava/lang/UnsupportedOperationException;
  136. invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V
  137. throw v0
  138. .end method