JsonStreamParser.smali 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. .class public final Lcom/google/gson/JsonStreamParser;
  2. .super Ljava/lang/Object;
  3. .source "JsonStreamParser.java"
  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 2
  21. .param p1, "reader" # Ljava/io/Reader;
  22. .line 68
  23. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  24. .line 69
  25. new-instance v0, Lcom/google/gson/stream/JsonReader;
  26. invoke-direct {v0, p1}, Lcom/google/gson/stream/JsonReader;-><init>(Ljava/io/Reader;)V
  27. iput-object v0, p0, Lcom/google/gson/JsonStreamParser;->parser:Lcom/google/gson/stream/JsonReader;
  28. .line 70
  29. iget-object v0, p0, Lcom/google/gson/JsonStreamParser;->parser:Lcom/google/gson/stream/JsonReader;
  30. const/4 v1, 0x1
  31. invoke-virtual {v0, v1}, Lcom/google/gson/stream/JsonReader;->setLenient(Z)V
  32. .line 71
  33. new-instance v0, Ljava/lang/Object;
  34. invoke-direct {v0}, Ljava/lang/Object;-><init>()V
  35. iput-object v0, p0, Lcom/google/gson/JsonStreamParser;->lock:Ljava/lang/Object;
  36. .line 72
  37. return-void
  38. .end method
  39. .method public constructor <init>(Ljava/lang/String;)V
  40. .locals 1
  41. .param p1, "json" # Ljava/lang/String;
  42. .line 61
  43. new-instance v0, Ljava/io/StringReader;
  44. invoke-direct {v0, p1}, Ljava/io/StringReader;-><init>(Ljava/lang/String;)V
  45. invoke-direct {p0, v0}, Lcom/google/gson/JsonStreamParser;-><init>(Ljava/io/Reader;)V
  46. .line 62
  47. return-void
  48. .end method
  49. # virtual methods
  50. .method public hasNext()Z
  51. .locals 3
  52. .line 103
  53. iget-object v0, p0, Lcom/google/gson/JsonStreamParser;->lock:Ljava/lang/Object;
  54. monitor-enter v0
  55. .line 105
  56. :try_start_0
  57. iget-object v1, p0, Lcom/google/gson/JsonStreamParser;->parser:Lcom/google/gson/stream/JsonReader;
  58. invoke-virtual {v1}, Lcom/google/gson/stream/JsonReader;->peek()Lcom/google/gson/stream/JsonToken;
  59. move-result-object v1
  60. sget-object v2, Lcom/google/gson/stream/JsonToken;->END_DOCUMENT:Lcom/google/gson/stream/JsonToken;
  61. :try_end_0
  62. .catch Lcom/google/gson/stream/MalformedJsonException; {:try_start_0 .. :try_end_0} :catch_1
  63. .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
  64. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  65. if-eq v1, v2, :cond_0
  66. const/4 v1, 0x1
  67. goto :goto_0
  68. :cond_0
  69. const/4 v1, 0x0
  70. :goto_0
  71. :try_start_1
  72. monitor-exit v0
  73. return v1
  74. .line 111
  75. :catchall_0
  76. move-exception v1
  77. goto :goto_1
  78. .line 108
  79. :catch_0
  80. move-exception v1
  81. .line 109
  82. .local v1, "e":Ljava/io/IOException;
  83. new-instance v2, Lcom/google/gson/JsonIOException;
  84. invoke-direct {v2, v1}, Lcom/google/gson/JsonIOException;-><init>(Ljava/lang/Throwable;)V
  85. throw v2
  86. .line 106
  87. .end local v1 # "e":Ljava/io/IOException;
  88. :catch_1
  89. move-exception v1
  90. .line 107
  91. .local v1, "e":Lcom/google/gson/stream/MalformedJsonException;
  92. new-instance v2, Lcom/google/gson/JsonSyntaxException;
  93. invoke-direct {v2, v1}, Lcom/google/gson/JsonSyntaxException;-><init>(Ljava/lang/Throwable;)V
  94. throw v2
  95. .line 111
  96. .end local v1 # "e":Lcom/google/gson/stream/MalformedJsonException;
  97. :goto_1
  98. monitor-exit v0
  99. :try_end_1
  100. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  101. throw v1
  102. .end method
  103. .method public next()Lcom/google/gson/JsonElement;
  104. .locals 3
  105. .annotation system Ldalvik/annotation/Throws;
  106. value = {
  107. Lcom/google/gson/JsonParseException;
  108. }
  109. .end annotation
  110. .line 82
  111. const-string v0, "Failed parsing JSON source to Json"
  112. invoke-virtual {p0}, Lcom/google/gson/JsonStreamParser;->hasNext()Z
  113. move-result v1
  114. if-eqz v1, :cond_1
  115. .line 87
  116. :try_start_0
  117. iget-object v1, p0, Lcom/google/gson/JsonStreamParser;->parser:Lcom/google/gson/stream/JsonReader;
  118. invoke-static {v1}, Lcom/google/gson/internal/Streams;->parse(Lcom/google/gson/stream/JsonReader;)Lcom/google/gson/JsonElement;
  119. move-result-object v0
  120. :try_end_0
  121. .catch Ljava/lang/StackOverflowError; {:try_start_0 .. :try_end_0} :catch_2
  122. .catch Ljava/lang/OutOfMemoryError; {:try_start_0 .. :try_end_0} :catch_1
  123. .catch Lcom/google/gson/JsonParseException; {:try_start_0 .. :try_end_0} :catch_0
  124. return-object v0
  125. .line 92
  126. :catch_0
  127. move-exception v0
  128. .line 93
  129. .local v0, "e":Lcom/google/gson/JsonParseException;
  130. invoke-virtual {v0}, Lcom/google/gson/JsonParseException;->getCause()Ljava/lang/Throwable;
  131. move-result-object v1
  132. instance-of v1, v1, Ljava/io/EOFException;
  133. if-eqz v1, :cond_0
  134. new-instance v1, Ljava/util/NoSuchElementException;
  135. invoke-direct {v1}, Ljava/util/NoSuchElementException;-><init>()V
  136. goto :goto_0
  137. :cond_0
  138. move-object v1, v0
  139. :goto_0
  140. throw v1
  141. .line 90
  142. .end local v0 # "e":Lcom/google/gson/JsonParseException;
  143. :catch_1
  144. move-exception v1
  145. .line 91
  146. .local v1, "e":Ljava/lang/OutOfMemoryError;
  147. new-instance v2, Lcom/google/gson/JsonParseException;
  148. invoke-direct {v2, v0, v1}, Lcom/google/gson/JsonParseException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
  149. throw v2
  150. .line 88
  151. .end local v1 # "e":Ljava/lang/OutOfMemoryError;
  152. :catch_2
  153. move-exception v1
  154. .line 89
  155. .local v1, "e":Ljava/lang/StackOverflowError;
  156. new-instance v2, Lcom/google/gson/JsonParseException;
  157. invoke-direct {v2, v0, v1}, Lcom/google/gson/JsonParseException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
  158. throw v2
  159. .line 83
  160. .end local v1 # "e":Ljava/lang/StackOverflowError;
  161. :cond_1
  162. new-instance v0, Ljava/util/NoSuchElementException;
  163. invoke-direct {v0}, Ljava/util/NoSuchElementException;-><init>()V
  164. throw v0
  165. .end method
  166. .method public bridge synthetic next()Ljava/lang/Object;
  167. .locals 1
  168. .line 52
  169. invoke-virtual {p0}, Lcom/google/gson/JsonStreamParser;->next()Lcom/google/gson/JsonElement;
  170. move-result-object v0
  171. return-object v0
  172. .end method
  173. .method public remove()V
  174. .locals 1
  175. .line 120
  176. new-instance v0, Ljava/lang/UnsupportedOperationException;
  177. invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V
  178. throw v0
  179. .end method