Response.smali 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. .class public final Lokhttp3/Response;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Ljava/io/Closeable;
  6. # annotations
  7. .annotation system Ldalvik/annotation/MemberClasses;
  8. value = {
  9. Lokhttp3/Response$Builder;
  10. }
  11. .end annotation
  12. # instance fields
  13. .field final body:Lokhttp3/ResponseBody;
  14. .field private volatile cacheControl:Lokhttp3/CacheControl;
  15. .field final cacheResponse:Lokhttp3/Response;
  16. .field final code:I
  17. .field final handshake:Lokhttp3/Handshake;
  18. .field final headers:Lokhttp3/Headers;
  19. .field final message:Ljava/lang/String;
  20. .field final networkResponse:Lokhttp3/Response;
  21. .field final priorResponse:Lokhttp3/Response;
  22. .field final protocol:Lokhttp3/Protocol;
  23. .field final receivedResponseAtMillis:J
  24. .field final request:Lokhttp3/Request;
  25. .field final sentRequestAtMillis:J
  26. # direct methods
  27. .method constructor <init>(Lokhttp3/Response$Builder;)V
  28. .locals 2
  29. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  30. iget-object v0, p1, Lokhttp3/Response$Builder;->request:Lokhttp3/Request;
  31. iput-object v0, p0, Lokhttp3/Response;->request:Lokhttp3/Request;
  32. iget-object v0, p1, Lokhttp3/Response$Builder;->protocol:Lokhttp3/Protocol;
  33. iput-object v0, p0, Lokhttp3/Response;->protocol:Lokhttp3/Protocol;
  34. iget v0, p1, Lokhttp3/Response$Builder;->code:I
  35. iput v0, p0, Lokhttp3/Response;->code:I
  36. iget-object v0, p1, Lokhttp3/Response$Builder;->message:Ljava/lang/String;
  37. iput-object v0, p0, Lokhttp3/Response;->message:Ljava/lang/String;
  38. iget-object v0, p1, Lokhttp3/Response$Builder;->handshake:Lokhttp3/Handshake;
  39. iput-object v0, p0, Lokhttp3/Response;->handshake:Lokhttp3/Handshake;
  40. iget-object v0, p1, Lokhttp3/Response$Builder;->headers:Lokhttp3/Headers$Builder;
  41. invoke-virtual {v0}, Lokhttp3/Headers$Builder;->build()Lokhttp3/Headers;
  42. move-result-object v0
  43. iput-object v0, p0, Lokhttp3/Response;->headers:Lokhttp3/Headers;
  44. iget-object v0, p1, Lokhttp3/Response$Builder;->body:Lokhttp3/ResponseBody;
  45. iput-object v0, p0, Lokhttp3/Response;->body:Lokhttp3/ResponseBody;
  46. iget-object v0, p1, Lokhttp3/Response$Builder;->networkResponse:Lokhttp3/Response;
  47. iput-object v0, p0, Lokhttp3/Response;->networkResponse:Lokhttp3/Response;
  48. iget-object v0, p1, Lokhttp3/Response$Builder;->cacheResponse:Lokhttp3/Response;
  49. iput-object v0, p0, Lokhttp3/Response;->cacheResponse:Lokhttp3/Response;
  50. iget-object v0, p1, Lokhttp3/Response$Builder;->priorResponse:Lokhttp3/Response;
  51. iput-object v0, p0, Lokhttp3/Response;->priorResponse:Lokhttp3/Response;
  52. iget-wide v0, p1, Lokhttp3/Response$Builder;->sentRequestAtMillis:J
  53. iput-wide v0, p0, Lokhttp3/Response;->sentRequestAtMillis:J
  54. iget-wide v0, p1, Lokhttp3/Response$Builder;->receivedResponseAtMillis:J
  55. iput-wide v0, p0, Lokhttp3/Response;->receivedResponseAtMillis:J
  56. return-void
  57. .end method
  58. # virtual methods
  59. .method public body()Lokhttp3/ResponseBody;
  60. .locals 1
  61. iget-object v0, p0, Lokhttp3/Response;->body:Lokhttp3/ResponseBody;
  62. return-object v0
  63. .end method
  64. .method public cacheControl()Lokhttp3/CacheControl;
  65. .locals 1
  66. iget-object v0, p0, Lokhttp3/Response;->cacheControl:Lokhttp3/CacheControl;
  67. if-eqz v0, :cond_0
  68. goto :goto_0
  69. :cond_0
  70. iget-object v0, p0, Lokhttp3/Response;->headers:Lokhttp3/Headers;
  71. invoke-static {v0}, Lokhttp3/CacheControl;->parse(Lokhttp3/Headers;)Lokhttp3/CacheControl;
  72. move-result-object v0
  73. iput-object v0, p0, Lokhttp3/Response;->cacheControl:Lokhttp3/CacheControl;
  74. :goto_0
  75. return-object v0
  76. .end method
  77. .method public cacheResponse()Lokhttp3/Response;
  78. .locals 1
  79. iget-object v0, p0, Lokhttp3/Response;->cacheResponse:Lokhttp3/Response;
  80. return-object v0
  81. .end method
  82. .method public challenges()Ljava/util/List;
  83. .locals 2
  84. .annotation system Ldalvik/annotation/Signature;
  85. value = {
  86. "()",
  87. "Ljava/util/List<",
  88. "Lokhttp3/Challenge;",
  89. ">;"
  90. }
  91. .end annotation
  92. iget v0, p0, Lokhttp3/Response;->code:I
  93. const/16 v1, 0x191
  94. if-ne v0, v1, :cond_0
  95. const-string v0, "WWW-Authenticate"
  96. goto :goto_0
  97. :cond_0
  98. const/16 v1, 0x197
  99. if-ne v0, v1, :cond_1
  100. const-string v0, "Proxy-Authenticate"
  101. :goto_0
  102. invoke-virtual {p0}, Lokhttp3/Response;->headers()Lokhttp3/Headers;
  103. move-result-object v1
  104. invoke-static {v1, v0}, Lokhttp3/internal/http/HttpHeaders;->parseChallenges(Lokhttp3/Headers;Ljava/lang/String;)Ljava/util/List;
  105. move-result-object v0
  106. return-object v0
  107. :cond_1
  108. invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
  109. move-result-object v0
  110. return-object v0
  111. .end method
  112. .method public close()V
  113. .locals 2
  114. iget-object v0, p0, Lokhttp3/Response;->body:Lokhttp3/ResponseBody;
  115. if-eqz v0, :cond_0
  116. invoke-virtual {v0}, Lokhttp3/ResponseBody;->close()V
  117. return-void
  118. :cond_0
  119. new-instance v0, Ljava/lang/IllegalStateException;
  120. const-string v1, "response is not eligible for a body and must not be closed"
  121. invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  122. throw v0
  123. .end method
  124. .method public code()I
  125. .locals 1
  126. iget v0, p0, Lokhttp3/Response;->code:I
  127. return v0
  128. .end method
  129. .method public handshake()Lokhttp3/Handshake;
  130. .locals 1
  131. iget-object v0, p0, Lokhttp3/Response;->handshake:Lokhttp3/Handshake;
  132. return-object v0
  133. .end method
  134. .method public header(Ljava/lang/String;)Ljava/lang/String;
  135. .locals 1
  136. const/4 v0, 0x0
  137. invoke-virtual {p0, p1, v0}, Lokhttp3/Response;->header(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
  138. move-result-object p1
  139. return-object p1
  140. .end method
  141. .method public header(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
  142. .locals 1
  143. iget-object v0, p0, Lokhttp3/Response;->headers:Lokhttp3/Headers;
  144. invoke-virtual {v0, p1}, Lokhttp3/Headers;->get(Ljava/lang/String;)Ljava/lang/String;
  145. move-result-object p1
  146. if-eqz p1, :cond_0
  147. goto :goto_0
  148. :cond_0
  149. move-object p1, p2
  150. :goto_0
  151. return-object p1
  152. .end method
  153. .method public headers(Ljava/lang/String;)Ljava/util/List;
  154. .locals 1
  155. .annotation system Ldalvik/annotation/Signature;
  156. value = {
  157. "(",
  158. "Ljava/lang/String;",
  159. ")",
  160. "Ljava/util/List<",
  161. "Ljava/lang/String;",
  162. ">;"
  163. }
  164. .end annotation
  165. iget-object v0, p0, Lokhttp3/Response;->headers:Lokhttp3/Headers;
  166. invoke-virtual {v0, p1}, Lokhttp3/Headers;->values(Ljava/lang/String;)Ljava/util/List;
  167. move-result-object p1
  168. return-object p1
  169. .end method
  170. .method public headers()Lokhttp3/Headers;
  171. .locals 1
  172. iget-object v0, p0, Lokhttp3/Response;->headers:Lokhttp3/Headers;
  173. return-object v0
  174. .end method
  175. .method public isRedirect()Z
  176. .locals 2
  177. iget v0, p0, Lokhttp3/Response;->code:I
  178. const/16 v1, 0x133
  179. if-eq v0, v1, :cond_0
  180. const/16 v1, 0x134
  181. if-eq v0, v1, :cond_0
  182. packed-switch v0, :pswitch_data_0
  183. const/4 v0, 0x0
  184. return v0
  185. :cond_0
  186. :pswitch_0
  187. const/4 v0, 0x1
  188. return v0
  189. nop
  190. :pswitch_data_0
  191. .packed-switch 0x12c
  192. :pswitch_0
  193. :pswitch_0
  194. :pswitch_0
  195. :pswitch_0
  196. .end packed-switch
  197. .end method
  198. .method public isSuccessful()Z
  199. .locals 2
  200. iget v0, p0, Lokhttp3/Response;->code:I
  201. const/16 v1, 0xc8
  202. if-lt v0, v1, :cond_0
  203. const/16 v1, 0x12c
  204. if-ge v0, v1, :cond_0
  205. const/4 v0, 0x1
  206. goto :goto_0
  207. :cond_0
  208. const/4 v0, 0x0
  209. :goto_0
  210. return v0
  211. .end method
  212. .method public message()Ljava/lang/String;
  213. .locals 1
  214. iget-object v0, p0, Lokhttp3/Response;->message:Ljava/lang/String;
  215. return-object v0
  216. .end method
  217. .method public networkResponse()Lokhttp3/Response;
  218. .locals 1
  219. iget-object v0, p0, Lokhttp3/Response;->networkResponse:Lokhttp3/Response;
  220. return-object v0
  221. .end method
  222. .method public newBuilder()Lokhttp3/Response$Builder;
  223. .locals 1
  224. new-instance v0, Lokhttp3/Response$Builder;
  225. invoke-direct {v0, p0}, Lokhttp3/Response$Builder;-><init>(Lokhttp3/Response;)V
  226. return-object v0
  227. .end method
  228. .method public peekBody(J)Lokhttp3/ResponseBody;
  229. .locals 4
  230. .annotation system Ldalvik/annotation/Throws;
  231. value = {
  232. Ljava/io/IOException;
  233. }
  234. .end annotation
  235. iget-object v0, p0, Lokhttp3/Response;->body:Lokhttp3/ResponseBody;
  236. invoke-virtual {v0}, Lokhttp3/ResponseBody;->source()Lokio/BufferedSource;
  237. move-result-object v0
  238. invoke-interface {v0, p1, p2}, Lokio/BufferedSource;->request(J)Z
  239. invoke-interface {v0}, Lokio/BufferedSource;->buffer()Lokio/Buffer;
  240. move-result-object v0
  241. invoke-virtual {v0}, Lokio/Buffer;->clone()Lokio/Buffer;
  242. move-result-object v0
  243. invoke-virtual {v0}, Lokio/Buffer;->size()J
  244. move-result-wide v1
  245. cmp-long v3, v1, p1
  246. if-lez v3, :cond_0
  247. new-instance v1, Lokio/Buffer;
  248. invoke-direct {v1}, Lokio/Buffer;-><init>()V
  249. invoke-virtual {v1, v0, p1, p2}, Lokio/Buffer;->write(Lokio/Buffer;J)V
  250. invoke-virtual {v0}, Lokio/Buffer;->clear()V
  251. move-object v0, v1
  252. :cond_0
  253. iget-object p1, p0, Lokhttp3/Response;->body:Lokhttp3/ResponseBody;
  254. invoke-virtual {p1}, Lokhttp3/ResponseBody;->contentType()Lokhttp3/MediaType;
  255. move-result-object p1
  256. invoke-virtual {v0}, Lokio/Buffer;->size()J
  257. move-result-wide v1
  258. invoke-static {p1, v1, v2, v0}, Lokhttp3/ResponseBody;->create(Lokhttp3/MediaType;JLokio/BufferedSource;)Lokhttp3/ResponseBody;
  259. move-result-object p1
  260. return-object p1
  261. .end method
  262. .method public priorResponse()Lokhttp3/Response;
  263. .locals 1
  264. iget-object v0, p0, Lokhttp3/Response;->priorResponse:Lokhttp3/Response;
  265. return-object v0
  266. .end method
  267. .method public protocol()Lokhttp3/Protocol;
  268. .locals 1
  269. iget-object v0, p0, Lokhttp3/Response;->protocol:Lokhttp3/Protocol;
  270. return-object v0
  271. .end method
  272. .method public receivedResponseAtMillis()J
  273. .locals 2
  274. iget-wide v0, p0, Lokhttp3/Response;->receivedResponseAtMillis:J
  275. return-wide v0
  276. .end method
  277. .method public request()Lokhttp3/Request;
  278. .locals 1
  279. iget-object v0, p0, Lokhttp3/Response;->request:Lokhttp3/Request;
  280. return-object v0
  281. .end method
  282. .method public sentRequestAtMillis()J
  283. .locals 2
  284. iget-wide v0, p0, Lokhttp3/Response;->sentRequestAtMillis:J
  285. return-wide v0
  286. .end method
  287. .method public toString()Ljava/lang/String;
  288. .locals 2
  289. new-instance v0, Ljava/lang/StringBuilder;
  290. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  291. const-string v1, "Response{protocol="
  292. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  293. iget-object v1, p0, Lokhttp3/Response;->protocol:Lokhttp3/Protocol;
  294. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  295. const-string v1, ", code="
  296. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  297. iget v1, p0, Lokhttp3/Response;->code:I
  298. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  299. const-string v1, ", message="
  300. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  301. iget-object v1, p0, Lokhttp3/Response;->message:Ljava/lang/String;
  302. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  303. const-string v1, ", url="
  304. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  305. iget-object v1, p0, Lokhttp3/Response;->request:Lokhttp3/Request;
  306. invoke-virtual {v1}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
  307. move-result-object v1
  308. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  309. const/16 v1, 0x7d
  310. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
  311. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  312. move-result-object v0
  313. return-object v0
  314. .end method