FormBody.smali 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. .class public final Lokhttp3/FormBody;
  2. .super Lokhttp3/RequestBody;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/MemberClasses;
  6. value = {
  7. Lokhttp3/FormBody$Builder;
  8. }
  9. .end annotation
  10. # static fields
  11. .field private static final CONTENT_TYPE:Lokhttp3/MediaType;
  12. # instance fields
  13. .field private final encodedNames:Ljava/util/List;
  14. .annotation system Ldalvik/annotation/Signature;
  15. value = {
  16. "Ljava/util/List<",
  17. "Ljava/lang/String;",
  18. ">;"
  19. }
  20. .end annotation
  21. .end field
  22. .field private final encodedValues:Ljava/util/List;
  23. .annotation system Ldalvik/annotation/Signature;
  24. value = {
  25. "Ljava/util/List<",
  26. "Ljava/lang/String;",
  27. ">;"
  28. }
  29. .end annotation
  30. .end field
  31. # direct methods
  32. .method static constructor <clinit>()V
  33. .locals 1
  34. const-string v0, "application/x-www-form-urlencoded"
  35. invoke-static {v0}, Lokhttp3/MediaType;->parse(Ljava/lang/String;)Lokhttp3/MediaType;
  36. move-result-object v0
  37. sput-object v0, Lokhttp3/FormBody;->CONTENT_TYPE:Lokhttp3/MediaType;
  38. return-void
  39. .end method
  40. .method constructor <init>(Ljava/util/List;Ljava/util/List;)V
  41. .locals 0
  42. .annotation system Ldalvik/annotation/Signature;
  43. value = {
  44. "(",
  45. "Ljava/util/List<",
  46. "Ljava/lang/String;",
  47. ">;",
  48. "Ljava/util/List<",
  49. "Ljava/lang/String;",
  50. ">;)V"
  51. }
  52. .end annotation
  53. invoke-direct {p0}, Lokhttp3/RequestBody;-><init>()V
  54. invoke-static {p1}, Lokhttp3/internal/Util;->immutableList(Ljava/util/List;)Ljava/util/List;
  55. move-result-object p1
  56. iput-object p1, p0, Lokhttp3/FormBody;->encodedNames:Ljava/util/List;
  57. invoke-static {p2}, Lokhttp3/internal/Util;->immutableList(Ljava/util/List;)Ljava/util/List;
  58. move-result-object p1
  59. iput-object p1, p0, Lokhttp3/FormBody;->encodedValues:Ljava/util/List;
  60. return-void
  61. .end method
  62. .method private writeOrCountBytes(Lokio/BufferedSink;Z)J
  63. .locals 3
  64. if-eqz p2, :cond_0
  65. new-instance p1, Lokio/Buffer;
  66. invoke-direct {p1}, Lokio/Buffer;-><init>()V
  67. goto :goto_0
  68. :cond_0
  69. invoke-interface {p1}, Lokio/BufferedSink;->buffer()Lokio/Buffer;
  70. move-result-object p1
  71. :goto_0
  72. const/4 v0, 0x0
  73. iget-object v1, p0, Lokhttp3/FormBody;->encodedNames:Ljava/util/List;
  74. invoke-interface {v1}, Ljava/util/List;->size()I
  75. move-result v1
  76. :goto_1
  77. if-ge v0, v1, :cond_2
  78. if-lez v0, :cond_1
  79. const/16 v2, 0x26
  80. invoke-virtual {p1, v2}, Lokio/Buffer;->writeByte(I)Lokio/Buffer;
  81. :cond_1
  82. iget-object v2, p0, Lokhttp3/FormBody;->encodedNames:Ljava/util/List;
  83. invoke-interface {v2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
  84. move-result-object v2
  85. check-cast v2, Ljava/lang/String;
  86. invoke-virtual {p1, v2}, Lokio/Buffer;->writeUtf8(Ljava/lang/String;)Lokio/Buffer;
  87. const/16 v2, 0x3d
  88. invoke-virtual {p1, v2}, Lokio/Buffer;->writeByte(I)Lokio/Buffer;
  89. iget-object v2, p0, Lokhttp3/FormBody;->encodedValues:Ljava/util/List;
  90. invoke-interface {v2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
  91. move-result-object v2
  92. check-cast v2, Ljava/lang/String;
  93. invoke-virtual {p1, v2}, Lokio/Buffer;->writeUtf8(Ljava/lang/String;)Lokio/Buffer;
  94. add-int/lit8 v0, v0, 0x1
  95. goto :goto_1
  96. :cond_2
  97. if-eqz p2, :cond_3
  98. invoke-virtual {p1}, Lokio/Buffer;->size()J
  99. move-result-wide v0
  100. invoke-virtual {p1}, Lokio/Buffer;->clear()V
  101. goto :goto_2
  102. :cond_3
  103. const-wide/16 v0, 0x0
  104. :goto_2
  105. return-wide v0
  106. .end method
  107. # virtual methods
  108. .method public contentLength()J
  109. .locals 2
  110. const/4 v0, 0x0
  111. const/4 v1, 0x1
  112. invoke-direct {p0, v0, v1}, Lokhttp3/FormBody;->writeOrCountBytes(Lokio/BufferedSink;Z)J
  113. move-result-wide v0
  114. return-wide v0
  115. .end method
  116. .method public contentType()Lokhttp3/MediaType;
  117. .locals 1
  118. sget-object v0, Lokhttp3/FormBody;->CONTENT_TYPE:Lokhttp3/MediaType;
  119. return-object v0
  120. .end method
  121. .method public encodedName(I)Ljava/lang/String;
  122. .locals 1
  123. iget-object v0, p0, Lokhttp3/FormBody;->encodedNames:Ljava/util/List;
  124. invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;
  125. move-result-object p1
  126. check-cast p1, Ljava/lang/String;
  127. return-object p1
  128. .end method
  129. .method public encodedValue(I)Ljava/lang/String;
  130. .locals 1
  131. iget-object v0, p0, Lokhttp3/FormBody;->encodedValues:Ljava/util/List;
  132. invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;
  133. move-result-object p1
  134. check-cast p1, Ljava/lang/String;
  135. return-object p1
  136. .end method
  137. .method public name(I)Ljava/lang/String;
  138. .locals 1
  139. invoke-virtual {p0, p1}, Lokhttp3/FormBody;->encodedName(I)Ljava/lang/String;
  140. move-result-object p1
  141. const/4 v0, 0x1
  142. invoke-static {p1, v0}, Lokhttp3/HttpUrl;->percentDecode(Ljava/lang/String;Z)Ljava/lang/String;
  143. move-result-object p1
  144. return-object p1
  145. .end method
  146. .method public size()I
  147. .locals 1
  148. iget-object v0, p0, Lokhttp3/FormBody;->encodedNames:Ljava/util/List;
  149. invoke-interface {v0}, Ljava/util/List;->size()I
  150. move-result v0
  151. return v0
  152. .end method
  153. .method public value(I)Ljava/lang/String;
  154. .locals 1
  155. invoke-virtual {p0, p1}, Lokhttp3/FormBody;->encodedValue(I)Ljava/lang/String;
  156. move-result-object p1
  157. const/4 v0, 0x1
  158. invoke-static {p1, v0}, Lokhttp3/HttpUrl;->percentDecode(Ljava/lang/String;Z)Ljava/lang/String;
  159. move-result-object p1
  160. return-object p1
  161. .end method
  162. .method public writeTo(Lokio/BufferedSink;)V
  163. .locals 1
  164. .annotation system Ldalvik/annotation/Throws;
  165. value = {
  166. Ljava/io/IOException;
  167. }
  168. .end annotation
  169. const/4 v0, 0x0
  170. invoke-direct {p0, p1, v0}, Lokhttp3/FormBody;->writeOrCountBytes(Lokio/BufferedSink;Z)J
  171. return-void
  172. .end method