Util.smali 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185
  1. .class public final Lokhttp3/internal/Util;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # static fields
  5. .field public static final EMPTY_BYTE_ARRAY:[B
  6. .field public static final EMPTY_REQUEST:Lokhttp3/RequestBody;
  7. .field public static final EMPTY_RESPONSE:Lokhttp3/ResponseBody;
  8. .field public static final EMPTY_STRING_ARRAY:[Ljava/lang/String;
  9. .field public static final ISO_8859_1:Ljava/nio/charset/Charset;
  10. .field public static final NATURAL_ORDER:Ljava/util/Comparator;
  11. .annotation system Ldalvik/annotation/Signature;
  12. value = {
  13. "Ljava/util/Comparator<",
  14. "Ljava/lang/String;",
  15. ">;"
  16. }
  17. .end annotation
  18. .end field
  19. .field public static final UTC:Ljava/util/TimeZone;
  20. .field private static final UTF_16_BE:Ljava/nio/charset/Charset;
  21. .field private static final UTF_16_BE_BOM:Lokio/ByteString;
  22. .field private static final UTF_16_LE:Ljava/nio/charset/Charset;
  23. .field private static final UTF_16_LE_BOM:Lokio/ByteString;
  24. .field private static final UTF_32_BE:Ljava/nio/charset/Charset;
  25. .field private static final UTF_32_BE_BOM:Lokio/ByteString;
  26. .field private static final UTF_32_LE:Ljava/nio/charset/Charset;
  27. .field private static final UTF_32_LE_BOM:Lokio/ByteString;
  28. .field public static final UTF_8:Ljava/nio/charset/Charset;
  29. .field private static final UTF_8_BOM:Lokio/ByteString;
  30. .field private static final VERIFY_AS_IP_ADDRESS:Ljava/util/regex/Pattern;
  31. # direct methods
  32. .method static constructor <clinit>()V
  33. .locals 2
  34. const/4 v0, 0x0
  35. new-array v1, v0, [B
  36. sput-object v1, Lokhttp3/internal/Util;->EMPTY_BYTE_ARRAY:[B
  37. new-array v0, v0, [Ljava/lang/String;
  38. sput-object v0, Lokhttp3/internal/Util;->EMPTY_STRING_ARRAY:[Ljava/lang/String;
  39. sget-object v0, Lokhttp3/internal/Util;->EMPTY_BYTE_ARRAY:[B
  40. const/4 v1, 0x0
  41. invoke-static {v1, v0}, Lokhttp3/ResponseBody;->create(Lokhttp3/MediaType;[B)Lokhttp3/ResponseBody;
  42. move-result-object v0
  43. sput-object v0, Lokhttp3/internal/Util;->EMPTY_RESPONSE:Lokhttp3/ResponseBody;
  44. sget-object v0, Lokhttp3/internal/Util;->EMPTY_BYTE_ARRAY:[B
  45. invoke-static {v1, v0}, Lokhttp3/RequestBody;->create(Lokhttp3/MediaType;[B)Lokhttp3/RequestBody;
  46. move-result-object v0
  47. sput-object v0, Lokhttp3/internal/Util;->EMPTY_REQUEST:Lokhttp3/RequestBody;
  48. const-string v0, "efbbbf"
  49. invoke-static {v0}, Lokio/ByteString;->decodeHex(Ljava/lang/String;)Lokio/ByteString;
  50. move-result-object v0
  51. sput-object v0, Lokhttp3/internal/Util;->UTF_8_BOM:Lokio/ByteString;
  52. const-string v0, "feff"
  53. invoke-static {v0}, Lokio/ByteString;->decodeHex(Ljava/lang/String;)Lokio/ByteString;
  54. move-result-object v0
  55. sput-object v0, Lokhttp3/internal/Util;->UTF_16_BE_BOM:Lokio/ByteString;
  56. const-string v0, "fffe"
  57. invoke-static {v0}, Lokio/ByteString;->decodeHex(Ljava/lang/String;)Lokio/ByteString;
  58. move-result-object v0
  59. sput-object v0, Lokhttp3/internal/Util;->UTF_16_LE_BOM:Lokio/ByteString;
  60. const-string v0, "0000ffff"
  61. invoke-static {v0}, Lokio/ByteString;->decodeHex(Ljava/lang/String;)Lokio/ByteString;
  62. move-result-object v0
  63. sput-object v0, Lokhttp3/internal/Util;->UTF_32_BE_BOM:Lokio/ByteString;
  64. const-string v0, "ffff0000"
  65. invoke-static {v0}, Lokio/ByteString;->decodeHex(Ljava/lang/String;)Lokio/ByteString;
  66. move-result-object v0
  67. sput-object v0, Lokhttp3/internal/Util;->UTF_32_LE_BOM:Lokio/ByteString;
  68. const-string v0, "UTF-8"
  69. invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
  70. move-result-object v0
  71. sput-object v0, Lokhttp3/internal/Util;->UTF_8:Ljava/nio/charset/Charset;
  72. const-string v0, "ISO-8859-1"
  73. invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
  74. move-result-object v0
  75. sput-object v0, Lokhttp3/internal/Util;->ISO_8859_1:Ljava/nio/charset/Charset;
  76. const-string v0, "UTF-16BE"
  77. invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
  78. move-result-object v0
  79. sput-object v0, Lokhttp3/internal/Util;->UTF_16_BE:Ljava/nio/charset/Charset;
  80. const-string v0, "UTF-16LE"
  81. invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
  82. move-result-object v0
  83. sput-object v0, Lokhttp3/internal/Util;->UTF_16_LE:Ljava/nio/charset/Charset;
  84. const-string v0, "UTF-32BE"
  85. invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
  86. move-result-object v0
  87. sput-object v0, Lokhttp3/internal/Util;->UTF_32_BE:Ljava/nio/charset/Charset;
  88. const-string v0, "UTF-32LE"
  89. invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
  90. move-result-object v0
  91. sput-object v0, Lokhttp3/internal/Util;->UTF_32_LE:Ljava/nio/charset/Charset;
  92. const-string v0, "GMT"
  93. invoke-static {v0}, Ljava/util/TimeZone;->getTimeZone(Ljava/lang/String;)Ljava/util/TimeZone;
  94. move-result-object v0
  95. sput-object v0, Lokhttp3/internal/Util;->UTC:Ljava/util/TimeZone;
  96. new-instance v0, Lokhttp3/internal/Util$1;
  97. invoke-direct {v0}, Lokhttp3/internal/Util$1;-><init>()V
  98. sput-object v0, Lokhttp3/internal/Util;->NATURAL_ORDER:Ljava/util/Comparator;
  99. const-string v0, "([0-9a-fA-F]*:[0-9a-fA-F:.]*)|([\\d.]+)"
  100. invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
  101. move-result-object v0
  102. sput-object v0, Lokhttp3/internal/Util;->VERIFY_AS_IP_ADDRESS:Ljava/util/regex/Pattern;
  103. return-void
  104. .end method
  105. .method private constructor <init>()V
  106. .locals 0
  107. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  108. return-void
  109. .end method
  110. .method public static assertionError(Ljava/lang/String;Ljava/lang/Exception;)Ljava/lang/AssertionError;
  111. .locals 1
  112. new-instance v0, Ljava/lang/AssertionError;
  113. invoke-direct {v0, p0}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
  114. invoke-virtual {v0, p1}, Ljava/lang/AssertionError;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;
  115. move-result-object p0
  116. check-cast p0, Ljava/lang/AssertionError;
  117. return-object p0
  118. .end method
  119. .method public static bomAwareCharset(Lokio/BufferedSource;Ljava/nio/charset/Charset;)Ljava/nio/charset/Charset;
  120. .locals 3
  121. .annotation system Ldalvik/annotation/Throws;
  122. value = {
  123. Ljava/io/IOException;
  124. }
  125. .end annotation
  126. sget-object v0, Lokhttp3/internal/Util;->UTF_8_BOM:Lokio/ByteString;
  127. const-wide/16 v1, 0x0
  128. invoke-interface {p0, v1, v2, v0}, Lokio/BufferedSource;->rangeEquals(JLokio/ByteString;)Z
  129. move-result v0
  130. if-eqz v0, :cond_0
  131. sget-object p1, Lokhttp3/internal/Util;->UTF_8_BOM:Lokio/ByteString;
  132. invoke-virtual {p1}, Lokio/ByteString;->size()I
  133. move-result p1
  134. int-to-long v0, p1
  135. invoke-interface {p0, v0, v1}, Lokio/BufferedSource;->skip(J)V
  136. sget-object p0, Lokhttp3/internal/Util;->UTF_8:Ljava/nio/charset/Charset;
  137. return-object p0
  138. :cond_0
  139. sget-object v0, Lokhttp3/internal/Util;->UTF_16_BE_BOM:Lokio/ByteString;
  140. invoke-interface {p0, v1, v2, v0}, Lokio/BufferedSource;->rangeEquals(JLokio/ByteString;)Z
  141. move-result v0
  142. if-eqz v0, :cond_1
  143. sget-object p1, Lokhttp3/internal/Util;->UTF_16_BE_BOM:Lokio/ByteString;
  144. invoke-virtual {p1}, Lokio/ByteString;->size()I
  145. move-result p1
  146. int-to-long v0, p1
  147. invoke-interface {p0, v0, v1}, Lokio/BufferedSource;->skip(J)V
  148. sget-object p0, Lokhttp3/internal/Util;->UTF_16_BE:Ljava/nio/charset/Charset;
  149. return-object p0
  150. :cond_1
  151. sget-object v0, Lokhttp3/internal/Util;->UTF_16_LE_BOM:Lokio/ByteString;
  152. invoke-interface {p0, v1, v2, v0}, Lokio/BufferedSource;->rangeEquals(JLokio/ByteString;)Z
  153. move-result v0
  154. if-eqz v0, :cond_2
  155. sget-object p1, Lokhttp3/internal/Util;->UTF_16_LE_BOM:Lokio/ByteString;
  156. invoke-virtual {p1}, Lokio/ByteString;->size()I
  157. move-result p1
  158. int-to-long v0, p1
  159. invoke-interface {p0, v0, v1}, Lokio/BufferedSource;->skip(J)V
  160. sget-object p0, Lokhttp3/internal/Util;->UTF_16_LE:Ljava/nio/charset/Charset;
  161. return-object p0
  162. :cond_2
  163. sget-object v0, Lokhttp3/internal/Util;->UTF_32_BE_BOM:Lokio/ByteString;
  164. invoke-interface {p0, v1, v2, v0}, Lokio/BufferedSource;->rangeEquals(JLokio/ByteString;)Z
  165. move-result v0
  166. if-eqz v0, :cond_3
  167. sget-object p1, Lokhttp3/internal/Util;->UTF_32_BE_BOM:Lokio/ByteString;
  168. invoke-virtual {p1}, Lokio/ByteString;->size()I
  169. move-result p1
  170. int-to-long v0, p1
  171. invoke-interface {p0, v0, v1}, Lokio/BufferedSource;->skip(J)V
  172. sget-object p0, Lokhttp3/internal/Util;->UTF_32_BE:Ljava/nio/charset/Charset;
  173. return-object p0
  174. :cond_3
  175. sget-object v0, Lokhttp3/internal/Util;->UTF_32_LE_BOM:Lokio/ByteString;
  176. invoke-interface {p0, v1, v2, v0}, Lokio/BufferedSource;->rangeEquals(JLokio/ByteString;)Z
  177. move-result v0
  178. if-eqz v0, :cond_4
  179. sget-object p1, Lokhttp3/internal/Util;->UTF_32_LE_BOM:Lokio/ByteString;
  180. invoke-virtual {p1}, Lokio/ByteString;->size()I
  181. move-result p1
  182. int-to-long v0, p1
  183. invoke-interface {p0, v0, v1}, Lokio/BufferedSource;->skip(J)V
  184. sget-object p0, Lokhttp3/internal/Util;->UTF_32_LE:Ljava/nio/charset/Charset;
  185. return-object p0
  186. :cond_4
  187. return-object p1
  188. .end method
  189. .method public static canonicalizeHost(Ljava/lang/String;)Ljava/lang/String;
  190. .locals 3
  191. const-string v0, ":"
  192. invoke-virtual {p0, v0}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
  193. move-result v0
  194. const/4 v1, 0x0
  195. if-eqz v0, :cond_3
  196. const-string v0, "["
  197. invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
  198. move-result v0
  199. if-eqz v0, :cond_0
  200. const-string v0, "]"
  201. invoke-virtual {p0, v0}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
  202. move-result v0
  203. if-eqz v0, :cond_0
  204. invoke-virtual {p0}, Ljava/lang/String;->length()I
  205. move-result v0
  206. const/4 v2, 0x1
  207. sub-int/2addr v0, v2
  208. invoke-static {p0, v2, v0}, Lokhttp3/internal/Util;->decodeIpv6(Ljava/lang/String;II)Ljava/net/InetAddress;
  209. move-result-object v0
  210. goto :goto_0
  211. :cond_0
  212. const/4 v0, 0x0
  213. invoke-virtual {p0}, Ljava/lang/String;->length()I
  214. move-result v2
  215. invoke-static {p0, v0, v2}, Lokhttp3/internal/Util;->decodeIpv6(Ljava/lang/String;II)Ljava/net/InetAddress;
  216. move-result-object v0
  217. :goto_0
  218. if-nez v0, :cond_1
  219. return-object v1
  220. :cond_1
  221. invoke-virtual {v0}, Ljava/net/InetAddress;->getAddress()[B
  222. move-result-object v0
  223. array-length v1, v0
  224. const/16 v2, 0x10
  225. if-ne v1, v2, :cond_2
  226. invoke-static {v0}, Lokhttp3/internal/Util;->inet6AddressToAscii([B)Ljava/lang/String;
  227. move-result-object p0
  228. return-object p0
  229. :cond_2
  230. new-instance v0, Ljava/lang/AssertionError;
  231. new-instance v1, Ljava/lang/StringBuilder;
  232. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  233. const-string v2, "Invalid IPv6 address: \'"
  234. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  235. invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  236. const-string p0, "\'"
  237. invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  238. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  239. move-result-object p0
  240. invoke-direct {v0, p0}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
  241. throw v0
  242. :cond_3
  243. :try_start_0
  244. invoke-static {p0}, Ljava/net/IDN;->toASCII(Ljava/lang/String;)Ljava/lang/String;
  245. move-result-object p0
  246. sget-object v0, Ljava/util/Locale;->US:Ljava/util/Locale;
  247. invoke-virtual {p0, v0}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
  248. move-result-object p0
  249. invoke-virtual {p0}, Ljava/lang/String;->isEmpty()Z
  250. move-result v0
  251. if-eqz v0, :cond_4
  252. return-object v1
  253. :cond_4
  254. invoke-static {p0}, Lokhttp3/internal/Util;->containsInvalidHostnameAsciiCodes(Ljava/lang/String;)Z
  255. move-result v0
  256. :try_end_0
  257. .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0
  258. if-eqz v0, :cond_5
  259. return-object v1
  260. :cond_5
  261. return-object p0
  262. :catch_0
  263. return-object v1
  264. .end method
  265. .method public static checkDuration(Ljava/lang/String;JLjava/util/concurrent/TimeUnit;)I
  266. .locals 6
  267. const-wide/16 v0, 0x0
  268. cmp-long v2, p1, v0
  269. if-ltz v2, :cond_4
  270. if-eqz p3, :cond_3
  271. invoke-virtual {p3, p1, p2}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J
  272. move-result-wide v2
  273. const-wide/32 v4, 0x7fffffff
  274. cmp-long p3, v2, v4
  275. if-gtz p3, :cond_2
  276. cmp-long p3, v2, v0
  277. if-nez p3, :cond_1
  278. cmp-long p3, p1, v0
  279. if-gtz p3, :cond_0
  280. goto :goto_0
  281. :cond_0
  282. new-instance p1, Ljava/lang/IllegalArgumentException;
  283. new-instance p2, Ljava/lang/StringBuilder;
  284. invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
  285. invoke-virtual {p2, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  286. const-string p0, " too small."
  287. invoke-virtual {p2, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  288. invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  289. move-result-object p0
  290. invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  291. throw p1
  292. :cond_1
  293. :goto_0
  294. long-to-int p0, v2
  295. return p0
  296. :cond_2
  297. new-instance p1, Ljava/lang/IllegalArgumentException;
  298. new-instance p2, Ljava/lang/StringBuilder;
  299. invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
  300. invoke-virtual {p2, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  301. const-string p0, " too large."
  302. invoke-virtual {p2, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  303. invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  304. move-result-object p0
  305. invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  306. throw p1
  307. :cond_3
  308. new-instance p0, Ljava/lang/NullPointerException;
  309. const-string p1, "unit == null"
  310. invoke-direct {p0, p1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
  311. throw p0
  312. :cond_4
  313. new-instance p1, Ljava/lang/IllegalArgumentException;
  314. new-instance p2, Ljava/lang/StringBuilder;
  315. invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
  316. invoke-virtual {p2, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  317. const-string p0, " < 0"
  318. invoke-virtual {p2, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  319. invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  320. move-result-object p0
  321. invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  322. throw p1
  323. .end method
  324. .method public static checkOffsetAndCount(JJJ)V
  325. .locals 5
  326. or-long v0, p2, p4
  327. const-wide/16 v2, 0x0
  328. cmp-long v4, v0, v2
  329. if-ltz v4, :cond_0
  330. cmp-long v0, p2, p0
  331. if-gtz v0, :cond_0
  332. sub-long/2addr p0, p2
  333. cmp-long p2, p0, p4
  334. if-ltz p2, :cond_0
  335. return-void
  336. :cond_0
  337. new-instance p0, Ljava/lang/ArrayIndexOutOfBoundsException;
  338. invoke-direct {p0}, Ljava/lang/ArrayIndexOutOfBoundsException;-><init>()V
  339. throw p0
  340. .end method
  341. .method public static closeQuietly(Ljava/io/Closeable;)V
  342. .locals 0
  343. if-eqz p0, :cond_0
  344. :try_start_0
  345. invoke-interface {p0}, Ljava/io/Closeable;->close()V
  346. :try_end_0
  347. .catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0
  348. .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1
  349. goto :goto_0
  350. :catch_0
  351. move-exception p0
  352. throw p0
  353. :catch_1
  354. :cond_0
  355. :goto_0
  356. return-void
  357. .end method
  358. .method public static closeQuietly(Ljava/net/ServerSocket;)V
  359. .locals 0
  360. if-eqz p0, :cond_0
  361. :try_start_0
  362. invoke-virtual {p0}, Ljava/net/ServerSocket;->close()V
  363. :try_end_0
  364. .catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0
  365. .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1
  366. goto :goto_0
  367. :catch_0
  368. move-exception p0
  369. throw p0
  370. :catch_1
  371. :cond_0
  372. :goto_0
  373. return-void
  374. .end method
  375. .method public static closeQuietly(Ljava/net/Socket;)V
  376. .locals 1
  377. if-eqz p0, :cond_1
  378. :try_start_0
  379. invoke-virtual {p0}, Ljava/net/Socket;->close()V
  380. :try_end_0
  381. .catch Ljava/lang/AssertionError; {:try_start_0 .. :try_end_0} :catch_1
  382. .catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0
  383. .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_2
  384. goto :goto_0
  385. :catch_0
  386. move-exception p0
  387. throw p0
  388. :catch_1
  389. move-exception p0
  390. invoke-static {p0}, Lokhttp3/internal/Util;->isAndroidGetsocknameError(Ljava/lang/AssertionError;)Z
  391. move-result v0
  392. if-eqz v0, :cond_0
  393. goto :goto_0
  394. :cond_0
  395. throw p0
  396. :catch_2
  397. :cond_1
  398. :goto_0
  399. return-void
  400. .end method
  401. .method public static concat([Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;
  402. .locals 3
  403. array-length v0, p0
  404. add-int/lit8 v0, v0, 0x1
  405. new-array v0, v0, [Ljava/lang/String;
  406. array-length v1, p0
  407. const/4 v2, 0x0
  408. invoke-static {p0, v2, v0, v2, v1}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
  409. array-length p0, v0
  410. add-int/lit8 p0, p0, -0x1
  411. aput-object p1, v0, p0
  412. return-object v0
  413. .end method
  414. .method private static containsInvalidHostnameAsciiCodes(Ljava/lang/String;)Z
  415. .locals 5
  416. const/4 v0, 0x0
  417. const/4 v1, 0x0
  418. :goto_0
  419. invoke-virtual {p0}, Ljava/lang/String;->length()I
  420. move-result v2
  421. if-ge v1, v2, :cond_3
  422. invoke-virtual {p0, v1}, Ljava/lang/String;->charAt(I)C
  423. move-result v2
  424. const/16 v3, 0x1f
  425. const/4 v4, 0x1
  426. if-le v2, v3, :cond_2
  427. const/16 v3, 0x7f
  428. if-lt v2, v3, :cond_0
  429. goto :goto_1
  430. :cond_0
  431. const-string v3, " #%/:?@[\\]"
  432. invoke-virtual {v3, v2}, Ljava/lang/String;->indexOf(I)I
  433. move-result v2
  434. const/4 v3, -0x1
  435. if-eq v2, v3, :cond_1
  436. return v4
  437. :cond_1
  438. add-int/lit8 v1, v1, 0x1
  439. goto :goto_0
  440. :cond_2
  441. :goto_1
  442. return v4
  443. :cond_3
  444. return v0
  445. .end method
  446. .method public static decodeHexDigit(C)I
  447. .locals 2
  448. const/16 v0, 0x30
  449. if-lt p0, v0, :cond_0
  450. const/16 v1, 0x39
  451. if-gt p0, v1, :cond_0
  452. sub-int/2addr p0, v0
  453. return p0
  454. :cond_0
  455. const/16 v0, 0x61
  456. if-lt p0, v0, :cond_1
  457. const/16 v1, 0x66
  458. if-gt p0, v1, :cond_1
  459. :goto_0
  460. sub-int/2addr p0, v0
  461. add-int/lit8 p0, p0, 0xa
  462. return p0
  463. :cond_1
  464. const/16 v0, 0x41
  465. if-lt p0, v0, :cond_2
  466. const/16 v1, 0x46
  467. if-gt p0, v1, :cond_2
  468. goto :goto_0
  469. :cond_2
  470. const/4 p0, -0x1
  471. return p0
  472. .end method
  473. .method private static decodeIpv4Suffix(Ljava/lang/String;II[BI)Z
  474. .locals 7
  475. move v0, p4
  476. :goto_0
  477. const/4 v1, 0x0
  478. if-ge p1, p2, :cond_8
  479. array-length v2, p3
  480. if-ne v0, v2, :cond_0
  481. return v1
  482. :cond_0
  483. if-eq v0, p4, :cond_2
  484. invoke-virtual {p0, p1}, Ljava/lang/String;->charAt(I)C
  485. move-result v2
  486. const/16 v3, 0x2e
  487. if-eq v2, v3, :cond_1
  488. return v1
  489. :cond_1
  490. add-int/lit8 p1, p1, 0x1
  491. :cond_2
  492. move v2, p1
  493. const/4 v3, 0x0
  494. :goto_1
  495. if-ge v2, p2, :cond_6
  496. invoke-virtual {p0, v2}, Ljava/lang/String;->charAt(I)C
  497. move-result v4
  498. const/16 v5, 0x30
  499. if-lt v4, v5, :cond_6
  500. const/16 v6, 0x39
  501. if-le v4, v6, :cond_3
  502. goto :goto_2
  503. :cond_3
  504. if-nez v3, :cond_4
  505. if-eq p1, v2, :cond_4
  506. return v1
  507. :cond_4
  508. mul-int/lit8 v3, v3, 0xa
  509. add-int/2addr v3, v4
  510. sub-int/2addr v3, v5
  511. const/16 v4, 0xff
  512. if-le v3, v4, :cond_5
  513. return v1
  514. :cond_5
  515. add-int/lit8 v2, v2, 0x1
  516. goto :goto_1
  517. :cond_6
  518. :goto_2
  519. sub-int p1, v2, p1
  520. if-nez p1, :cond_7
  521. return v1
  522. :cond_7
  523. add-int/lit8 p1, v0, 0x1
  524. int-to-byte v1, v3
  525. aput-byte v1, p3, v0
  526. move v0, p1
  527. move p1, v2
  528. goto :goto_0
  529. :cond_8
  530. add-int/lit8 p4, p4, 0x4
  531. if-eq v0, p4, :cond_9
  532. return v1
  533. :cond_9
  534. const/4 p0, 0x1
  535. return p0
  536. .end method
  537. .method private static decodeIpv6(Ljava/lang/String;II)Ljava/net/InetAddress;
  538. .locals 10
  539. const/16 v0, 0x10
  540. new-array v0, v0, [B
  541. const/4 v1, -0x1
  542. const/4 v2, 0x0
  543. const/4 v3, 0x0
  544. const/4 v4, -0x1
  545. const/4 v5, -0x1
  546. :goto_0
  547. const/4 v6, 0x0
  548. if-ge p1, p2, :cond_c
  549. array-length v7, v0
  550. if-ne v3, v7, :cond_0
  551. return-object v6
  552. :cond_0
  553. add-int/lit8 v7, p1, 0x2
  554. if-gt v7, p2, :cond_3
  555. const/4 v8, 0x2
  556. const-string v9, "::"
  557. invoke-virtual {p0, p1, v9, v2, v8}, Ljava/lang/String;->regionMatches(ILjava/lang/String;II)Z
  558. move-result v8
  559. if-eqz v8, :cond_3
  560. if-eq v4, v1, :cond_1
  561. return-object v6
  562. :cond_1
  563. add-int/lit8 v3, v3, 0x2
  564. move v4, v3
  565. if-ne v7, p2, :cond_2
  566. goto :goto_6
  567. :cond_2
  568. move v5, v7
  569. goto :goto_2
  570. :cond_3
  571. if-eqz v3, :cond_7
  572. const/4 v7, 0x1
  573. const-string v8, ":"
  574. invoke-virtual {p0, p1, v8, v2, v7}, Ljava/lang/String;->regionMatches(ILjava/lang/String;II)Z
  575. move-result v8
  576. if-eqz v8, :cond_4
  577. add-int/lit8 p1, p1, 0x1
  578. goto :goto_1
  579. :cond_4
  580. const-string v8, "."
  581. invoke-virtual {p0, p1, v8, v2, v7}, Ljava/lang/String;->regionMatches(ILjava/lang/String;II)Z
  582. move-result p1
  583. if-eqz p1, :cond_6
  584. add-int/lit8 p1, v3, -0x2
  585. invoke-static {p0, v5, p2, v0, p1}, Lokhttp3/internal/Util;->decodeIpv4Suffix(Ljava/lang/String;II[BI)Z
  586. move-result p0
  587. if-nez p0, :cond_5
  588. return-object v6
  589. :cond_5
  590. add-int/lit8 v3, v3, 0x2
  591. goto :goto_6
  592. :cond_6
  593. return-object v6
  594. :cond_7
  595. :goto_1
  596. move v5, p1
  597. :goto_2
  598. move p1, v5
  599. const/4 v7, 0x0
  600. :goto_3
  601. if-ge p1, p2, :cond_9
  602. invoke-virtual {p0, p1}, Ljava/lang/String;->charAt(I)C
  603. move-result v8
  604. invoke-static {v8}, Lokhttp3/internal/Util;->decodeHexDigit(C)I
  605. move-result v8
  606. if-ne v8, v1, :cond_8
  607. goto :goto_4
  608. :cond_8
  609. shl-int/lit8 v7, v7, 0x4
  610. add-int/2addr v7, v8
  611. add-int/lit8 p1, p1, 0x1
  612. goto :goto_3
  613. :cond_9
  614. :goto_4
  615. sub-int v8, p1, v5
  616. if-eqz v8, :cond_b
  617. const/4 v9, 0x4
  618. if-le v8, v9, :cond_a
  619. goto :goto_5
  620. :cond_a
  621. add-int/lit8 v6, v3, 0x1
  622. ushr-int/lit8 v8, v7, 0x8
  623. and-int/lit16 v8, v8, 0xff
  624. int-to-byte v8, v8
  625. aput-byte v8, v0, v3
  626. add-int/lit8 v3, v6, 0x1
  627. and-int/lit16 v7, v7, 0xff
  628. int-to-byte v7, v7
  629. aput-byte v7, v0, v6
  630. goto :goto_0
  631. :cond_b
  632. :goto_5
  633. return-object v6
  634. :cond_c
  635. :goto_6
  636. array-length p0, v0
  637. if-eq v3, p0, :cond_e
  638. if-ne v4, v1, :cond_d
  639. return-object v6
  640. :cond_d
  641. array-length p0, v0
  642. sub-int p1, v3, v4
  643. sub-int/2addr p0, p1
  644. invoke-static {v0, v4, v0, p0, p1}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
  645. array-length p0, v0
  646. sub-int/2addr p0, v3
  647. add-int/2addr p0, v4
  648. invoke-static {v0, v4, p0, v2}, Ljava/util/Arrays;->fill([BIIB)V
  649. :cond_e
  650. :try_start_0
  651. invoke-static {v0}, Ljava/net/InetAddress;->getByAddress([B)Ljava/net/InetAddress;
  652. move-result-object p0
  653. :try_end_0
  654. .catch Ljava/net/UnknownHostException; {:try_start_0 .. :try_end_0} :catch_0
  655. return-object p0
  656. :catch_0
  657. new-instance p0, Ljava/lang/AssertionError;
  658. invoke-direct {p0}, Ljava/lang/AssertionError;-><init>()V
  659. goto :goto_8
  660. :goto_7
  661. throw p0
  662. :goto_8
  663. goto :goto_7
  664. .end method
  665. .method public static delimiterOffset(Ljava/lang/String;IIC)I
  666. .locals 1
  667. :goto_0
  668. if-ge p1, p2, :cond_1
  669. invoke-virtual {p0, p1}, Ljava/lang/String;->charAt(I)C
  670. move-result v0
  671. if-ne v0, p3, :cond_0
  672. return p1
  673. :cond_0
  674. add-int/lit8 p1, p1, 0x1
  675. goto :goto_0
  676. :cond_1
  677. return p2
  678. .end method
  679. .method public static delimiterOffset(Ljava/lang/String;IILjava/lang/String;)I
  680. .locals 2
  681. :goto_0
  682. if-ge p1, p2, :cond_1
  683. invoke-virtual {p0, p1}, Ljava/lang/String;->charAt(I)C
  684. move-result v0
  685. invoke-virtual {p3, v0}, Ljava/lang/String;->indexOf(I)I
  686. move-result v0
  687. const/4 v1, -0x1
  688. if-eq v0, v1, :cond_0
  689. return p1
  690. :cond_0
  691. add-int/lit8 p1, p1, 0x1
  692. goto :goto_0
  693. :cond_1
  694. return p2
  695. .end method
  696. .method public static discard(Lokio/Source;ILjava/util/concurrent/TimeUnit;)Z
  697. .locals 0
  698. :try_start_0
  699. invoke-static {p0, p1, p2}, Lokhttp3/internal/Util;->skipAll(Lokio/Source;ILjava/util/concurrent/TimeUnit;)Z
  700. move-result p0
  701. :try_end_0
  702. .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
  703. return p0
  704. :catch_0
  705. const/4 p0, 0x0
  706. return p0
  707. .end method
  708. .method public static equal(Ljava/lang/Object;Ljava/lang/Object;)Z
  709. .locals 0
  710. if-eq p0, p1, :cond_1
  711. if-eqz p0, :cond_0
  712. invoke-virtual {p0, p1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
  713. move-result p0
  714. if-eqz p0, :cond_0
  715. goto :goto_0
  716. :cond_0
  717. const/4 p0, 0x0
  718. goto :goto_1
  719. :cond_1
  720. :goto_0
  721. const/4 p0, 0x1
  722. :goto_1
  723. return p0
  724. .end method
  725. .method public static varargs format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
  726. .locals 1
  727. sget-object v0, Ljava/util/Locale;->US:Ljava/util/Locale;
  728. invoke-static {v0, p0, p1}, Ljava/lang/String;->format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
  729. move-result-object p0
  730. return-object p0
  731. .end method
  732. .method public static hostHeader(Lokhttp3/HttpUrl;Z)Ljava/lang/String;
  733. .locals 3
  734. invoke-virtual {p0}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  735. move-result-object v0
  736. const-string v1, ":"
  737. invoke-virtual {v0, v1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
  738. move-result v0
  739. if-eqz v0, :cond_0
  740. new-instance v0, Ljava/lang/StringBuilder;
  741. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  742. const-string v2, "["
  743. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  744. invoke-virtual {p0}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  745. move-result-object v2
  746. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  747. const-string v2, "]"
  748. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  749. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  750. move-result-object v0
  751. goto :goto_0
  752. :cond_0
  753. invoke-virtual {p0}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  754. move-result-object v0
  755. :goto_0
  756. if-nez p1, :cond_1
  757. invoke-virtual {p0}, Lokhttp3/HttpUrl;->port()I
  758. move-result p1
  759. invoke-virtual {p0}, Lokhttp3/HttpUrl;->scheme()Ljava/lang/String;
  760. move-result-object v2
  761. invoke-static {v2}, Lokhttp3/HttpUrl;->defaultPort(Ljava/lang/String;)I
  762. move-result v2
  763. if-eq p1, v2, :cond_2
  764. :cond_1
  765. new-instance p1, Ljava/lang/StringBuilder;
  766. invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
  767. invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  768. invoke-virtual {p1, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  769. invoke-virtual {p0}, Lokhttp3/HttpUrl;->port()I
  770. move-result p0
  771. invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  772. invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  773. move-result-object v0
  774. :cond_2
  775. return-object v0
  776. .end method
  777. .method public static immutableList(Ljava/util/List;)Ljava/util/List;
  778. .locals 1
  779. .annotation system Ldalvik/annotation/Signature;
  780. value = {
  781. "<T:",
  782. "Ljava/lang/Object;",
  783. ">(",
  784. "Ljava/util/List<",
  785. "TT;>;)",
  786. "Ljava/util/List<",
  787. "TT;>;"
  788. }
  789. .end annotation
  790. new-instance v0, Ljava/util/ArrayList;
  791. invoke-direct {v0, p0}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V
  792. invoke-static {v0}, Ljava/util/Collections;->unmodifiableList(Ljava/util/List;)Ljava/util/List;
  793. move-result-object p0
  794. return-object p0
  795. .end method
  796. .method public static varargs immutableList([Ljava/lang/Object;)Ljava/util/List;
  797. .locals 0
  798. .annotation system Ldalvik/annotation/Signature;
  799. value = {
  800. "<T:",
  801. "Ljava/lang/Object;",
  802. ">([TT;)",
  803. "Ljava/util/List<",
  804. "TT;>;"
  805. }
  806. .end annotation
  807. invoke-virtual {p0}, [Ljava/lang/Object;->clone()Ljava/lang/Object;
  808. move-result-object p0
  809. check-cast p0, [Ljava/lang/Object;
  810. invoke-static {p0}, Ljava/util/Arrays;->asList([Ljava/lang/Object;)Ljava/util/List;
  811. move-result-object p0
  812. invoke-static {p0}, Ljava/util/Collections;->unmodifiableList(Ljava/util/List;)Ljava/util/List;
  813. move-result-object p0
  814. return-object p0
  815. .end method
  816. .method public static indexOf(Ljava/util/Comparator;[Ljava/lang/String;Ljava/lang/String;)I
  817. .locals 3
  818. .annotation system Ldalvik/annotation/Signature;
  819. value = {
  820. "(",
  821. "Ljava/util/Comparator<",
  822. "Ljava/lang/String;",
  823. ">;[",
  824. "Ljava/lang/String;",
  825. "Ljava/lang/String;",
  826. ")I"
  827. }
  828. .end annotation
  829. array-length v0, p1
  830. const/4 v1, 0x0
  831. :goto_0
  832. if-ge v1, v0, :cond_1
  833. aget-object v2, p1, v1
  834. invoke-interface {p0, v2, p2}, Ljava/util/Comparator;->compare(Ljava/lang/Object;Ljava/lang/Object;)I
  835. move-result v2
  836. if-nez v2, :cond_0
  837. return v1
  838. :cond_0
  839. add-int/lit8 v1, v1, 0x1
  840. goto :goto_0
  841. :cond_1
  842. const/4 p0, -0x1
  843. return p0
  844. .end method
  845. .method public static indexOfControlOrNonAscii(Ljava/lang/String;)I
  846. .locals 4
  847. invoke-virtual {p0}, Ljava/lang/String;->length()I
  848. move-result v0
  849. const/4 v1, 0x0
  850. :goto_0
  851. if-ge v1, v0, :cond_2
  852. invoke-virtual {p0, v1}, Ljava/lang/String;->charAt(I)C
  853. move-result v2
  854. const/16 v3, 0x1f
  855. if-le v2, v3, :cond_1
  856. const/16 v3, 0x7f
  857. if-lt v2, v3, :cond_0
  858. goto :goto_1
  859. :cond_0
  860. add-int/lit8 v1, v1, 0x1
  861. goto :goto_0
  862. :cond_1
  863. :goto_1
  864. return v1
  865. :cond_2
  866. const/4 p0, -0x1
  867. return p0
  868. .end method
  869. .method private static inet6AddressToAscii([B)Ljava/lang/String;
  870. .locals 8
  871. const/4 v0, 0x0
  872. const/4 v1, -0x1
  873. const/4 v1, 0x0
  874. const/4 v2, -0x1
  875. const/4 v3, 0x0
  876. :goto_0
  877. array-length v4, p0
  878. const/16 v5, 0x10
  879. if-ge v1, v4, :cond_2
  880. move v4, v1
  881. :goto_1
  882. if-ge v4, v5, :cond_0
  883. aget-byte v6, p0, v4
  884. if-nez v6, :cond_0
  885. add-int/lit8 v6, v4, 0x1
  886. aget-byte v6, p0, v6
  887. if-nez v6, :cond_0
  888. add-int/lit8 v4, v4, 0x2
  889. goto :goto_1
  890. :cond_0
  891. sub-int v5, v4, v1
  892. if-le v5, v3, :cond_1
  893. const/4 v6, 0x4
  894. if-lt v5, v6, :cond_1
  895. move v2, v1
  896. move v3, v5
  897. :cond_1
  898. add-int/lit8 v1, v4, 0x2
  899. goto :goto_0
  900. :cond_2
  901. new-instance v1, Lokio/Buffer;
  902. invoke-direct {v1}, Lokio/Buffer;-><init>()V
  903. :cond_3
  904. :goto_2
  905. array-length v4, p0
  906. if-ge v0, v4, :cond_6
  907. const/16 v4, 0x3a
  908. if-ne v0, v2, :cond_4
  909. invoke-virtual {v1, v4}, Lokio/Buffer;->writeByte(I)Lokio/Buffer;
  910. add-int/2addr v0, v3
  911. if-ne v0, v5, :cond_3
  912. invoke-virtual {v1, v4}, Lokio/Buffer;->writeByte(I)Lokio/Buffer;
  913. goto :goto_2
  914. :cond_4
  915. if-lez v0, :cond_5
  916. invoke-virtual {v1, v4}, Lokio/Buffer;->writeByte(I)Lokio/Buffer;
  917. :cond_5
  918. aget-byte v4, p0, v0
  919. and-int/lit16 v4, v4, 0xff
  920. shl-int/lit8 v4, v4, 0x8
  921. add-int/lit8 v6, v0, 0x1
  922. aget-byte v6, p0, v6
  923. and-int/lit16 v6, v6, 0xff
  924. or-int/2addr v4, v6
  925. int-to-long v6, v4
  926. invoke-virtual {v1, v6, v7}, Lokio/Buffer;->writeHexadecimalUnsignedLong(J)Lokio/Buffer;
  927. add-int/lit8 v0, v0, 0x2
  928. goto :goto_2
  929. :cond_6
  930. invoke-virtual {v1}, Lokio/Buffer;->readUtf8()Ljava/lang/String;
  931. move-result-object p0
  932. return-object p0
  933. .end method
  934. .method public static intersect(Ljava/util/Comparator;[Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String;
  935. .locals 8
  936. .annotation system Ldalvik/annotation/Signature;
  937. value = {
  938. "(",
  939. "Ljava/util/Comparator<",
  940. "-",
  941. "Ljava/lang/String;",
  942. ">;[",
  943. "Ljava/lang/String;",
  944. "[",
  945. "Ljava/lang/String;",
  946. ")[",
  947. "Ljava/lang/String;"
  948. }
  949. .end annotation
  950. new-instance v0, Ljava/util/ArrayList;
  951. invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
  952. array-length v1, p1
  953. const/4 v2, 0x0
  954. const/4 v3, 0x0
  955. :goto_0
  956. if-ge v3, v1, :cond_2
  957. aget-object v4, p1, v3
  958. array-length v5, p2
  959. const/4 v6, 0x0
  960. :goto_1
  961. if-ge v6, v5, :cond_1
  962. aget-object v7, p2, v6
  963. invoke-interface {p0, v4, v7}, Ljava/util/Comparator;->compare(Ljava/lang/Object;Ljava/lang/Object;)I
  964. move-result v7
  965. if-nez v7, :cond_0
  966. invoke-interface {v0, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  967. goto :goto_2
  968. :cond_0
  969. add-int/lit8 v6, v6, 0x1
  970. goto :goto_1
  971. :cond_1
  972. :goto_2
  973. add-int/lit8 v3, v3, 0x1
  974. goto :goto_0
  975. :cond_2
  976. invoke-interface {v0}, Ljava/util/List;->size()I
  977. move-result p0
  978. new-array p0, p0, [Ljava/lang/String;
  979. invoke-interface {v0, p0}, Ljava/util/List;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
  980. move-result-object p0
  981. check-cast p0, [Ljava/lang/String;
  982. return-object p0
  983. .end method
  984. .method public static isAndroidGetsocknameError(Ljava/lang/AssertionError;)Z
  985. .locals 1
  986. invoke-virtual {p0}, Ljava/lang/AssertionError;->getCause()Ljava/lang/Throwable;
  987. move-result-object v0
  988. if-eqz v0, :cond_0
  989. invoke-virtual {p0}, Ljava/lang/AssertionError;->getMessage()Ljava/lang/String;
  990. move-result-object v0
  991. if-eqz v0, :cond_0
  992. invoke-virtual {p0}, Ljava/lang/AssertionError;->getMessage()Ljava/lang/String;
  993. move-result-object p0
  994. const-string v0, "getsockname failed"
  995. invoke-virtual {p0, v0}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
  996. move-result p0
  997. if-eqz p0, :cond_0
  998. const/4 p0, 0x1
  999. goto :goto_0
  1000. :cond_0
  1001. const/4 p0, 0x0
  1002. :goto_0
  1003. return p0
  1004. .end method
  1005. .method public static nonEmptyIntersection(Ljava/util/Comparator;[Ljava/lang/String;[Ljava/lang/String;)Z
  1006. .locals 7
  1007. .annotation system Ldalvik/annotation/Signature;
  1008. value = {
  1009. "(",
  1010. "Ljava/util/Comparator<",
  1011. "Ljava/lang/String;",
  1012. ">;[",
  1013. "Ljava/lang/String;",
  1014. "[",
  1015. "Ljava/lang/String;",
  1016. ")Z"
  1017. }
  1018. .end annotation
  1019. const/4 v0, 0x0
  1020. if-eqz p1, :cond_3
  1021. if-eqz p2, :cond_3
  1022. array-length v1, p1
  1023. if-eqz v1, :cond_3
  1024. array-length v1, p2
  1025. if-nez v1, :cond_0
  1026. goto :goto_2
  1027. :cond_0
  1028. array-length v1, p1
  1029. const/4 v2, 0x0
  1030. :goto_0
  1031. if-ge v2, v1, :cond_3
  1032. aget-object v3, p1, v2
  1033. array-length v4, p2
  1034. const/4 v5, 0x0
  1035. :goto_1
  1036. if-ge v5, v4, :cond_2
  1037. aget-object v6, p2, v5
  1038. invoke-interface {p0, v3, v6}, Ljava/util/Comparator;->compare(Ljava/lang/Object;Ljava/lang/Object;)I
  1039. move-result v6
  1040. if-nez v6, :cond_1
  1041. const/4 p0, 0x1
  1042. return p0
  1043. :cond_1
  1044. add-int/lit8 v5, v5, 0x1
  1045. goto :goto_1
  1046. :cond_2
  1047. add-int/lit8 v2, v2, 0x1
  1048. goto :goto_0
  1049. :cond_3
  1050. :goto_2
  1051. return v0
  1052. .end method
  1053. .method public static skipAll(Lokio/Source;ILjava/util/concurrent/TimeUnit;)Z
  1054. .locals 11
  1055. .annotation system Ldalvik/annotation/Throws;
  1056. value = {
  1057. Ljava/io/IOException;
  1058. }
  1059. .end annotation
  1060. invoke-static {}, Ljava/lang/System;->nanoTime()J
  1061. move-result-wide v0
  1062. invoke-interface {p0}, Lokio/Source;->timeout()Lokio/Timeout;
  1063. move-result-object v2
  1064. invoke-virtual {v2}, Lokio/Timeout;->hasDeadline()Z
  1065. move-result v2
  1066. const-wide v3, 0x7fffffffffffffffL
  1067. if-eqz v2, :cond_0
  1068. invoke-interface {p0}, Lokio/Source;->timeout()Lokio/Timeout;
  1069. move-result-object v2
  1070. invoke-virtual {v2}, Lokio/Timeout;->deadlineNanoTime()J
  1071. move-result-wide v5
  1072. sub-long/2addr v5, v0
  1073. goto :goto_0
  1074. :cond_0
  1075. move-wide v5, v3
  1076. :goto_0
  1077. invoke-interface {p0}, Lokio/Source;->timeout()Lokio/Timeout;
  1078. move-result-object v2
  1079. int-to-long v7, p1
  1080. invoke-virtual {p2, v7, v8}, Ljava/util/concurrent/TimeUnit;->toNanos(J)J
  1081. move-result-wide p1
  1082. invoke-static {v5, v6, p1, p2}, Ljava/lang/Math;->min(JJ)J
  1083. move-result-wide p1
  1084. add-long/2addr p1, v0
  1085. invoke-virtual {v2, p1, p2}, Lokio/Timeout;->deadlineNanoTime(J)Lokio/Timeout;
  1086. :try_start_0
  1087. new-instance p1, Lokio/Buffer;
  1088. invoke-direct {p1}, Lokio/Buffer;-><init>()V
  1089. :goto_1
  1090. const-wide/16 v7, 0x2000
  1091. invoke-interface {p0, p1, v7, v8}, Lokio/Source;->read(Lokio/Buffer;J)J
  1092. move-result-wide v7
  1093. const-wide/16 v9, -0x1
  1094. cmp-long p2, v7, v9
  1095. if-eqz p2, :cond_1
  1096. invoke-virtual {p1}, Lokio/Buffer;->clear()V
  1097. :try_end_0
  1098. .catch Ljava/io/InterruptedIOException; {:try_start_0 .. :try_end_0} :catch_0
  1099. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  1100. goto :goto_1
  1101. :cond_1
  1102. const/4 p1, 0x1
  1103. cmp-long p2, v5, v3
  1104. invoke-interface {p0}, Lokio/Source;->timeout()Lokio/Timeout;
  1105. move-result-object p0
  1106. if-nez p2, :cond_2
  1107. invoke-virtual {p0}, Lokio/Timeout;->clearDeadline()Lokio/Timeout;
  1108. goto :goto_2
  1109. :cond_2
  1110. add-long/2addr v0, v5
  1111. invoke-virtual {p0, v0, v1}, Lokio/Timeout;->deadlineNanoTime(J)Lokio/Timeout;
  1112. :goto_2
  1113. return p1
  1114. :catchall_0
  1115. move-exception p1
  1116. cmp-long p2, v5, v3
  1117. invoke-interface {p0}, Lokio/Source;->timeout()Lokio/Timeout;
  1118. move-result-object p0
  1119. if-nez p2, :cond_3
  1120. invoke-virtual {p0}, Lokio/Timeout;->clearDeadline()Lokio/Timeout;
  1121. goto :goto_3
  1122. :cond_3
  1123. add-long/2addr v0, v5
  1124. invoke-virtual {p0, v0, v1}, Lokio/Timeout;->deadlineNanoTime(J)Lokio/Timeout;
  1125. :goto_3
  1126. throw p1
  1127. :catch_0
  1128. nop
  1129. const/4 p1, 0x0
  1130. cmp-long p2, v5, v3
  1131. invoke-interface {p0}, Lokio/Source;->timeout()Lokio/Timeout;
  1132. move-result-object p0
  1133. if-nez p2, :cond_4
  1134. invoke-virtual {p0}, Lokio/Timeout;->clearDeadline()Lokio/Timeout;
  1135. goto :goto_4
  1136. :cond_4
  1137. add-long/2addr v0, v5
  1138. invoke-virtual {p0, v0, v1}, Lokio/Timeout;->deadlineNanoTime(J)Lokio/Timeout;
  1139. :goto_4
  1140. return p1
  1141. .end method
  1142. .method public static skipLeadingAsciiWhitespace(Ljava/lang/String;II)I
  1143. .locals 2
  1144. :goto_0
  1145. if-ge p1, p2, :cond_1
  1146. invoke-virtual {p0, p1}, Ljava/lang/String;->charAt(I)C
  1147. move-result v0
  1148. const/16 v1, 0x9
  1149. if-eq v0, v1, :cond_0
  1150. const/16 v1, 0xa
  1151. if-eq v0, v1, :cond_0
  1152. const/16 v1, 0xc
  1153. if-eq v0, v1, :cond_0
  1154. const/16 v1, 0xd
  1155. if-eq v0, v1, :cond_0
  1156. const/16 v1, 0x20
  1157. if-eq v0, v1, :cond_0
  1158. return p1
  1159. :cond_0
  1160. add-int/lit8 p1, p1, 0x1
  1161. goto :goto_0
  1162. :cond_1
  1163. return p2
  1164. .end method
  1165. .method public static skipTrailingAsciiWhitespace(Ljava/lang/String;II)I
  1166. .locals 2
  1167. add-int/lit8 p2, p2, -0x1
  1168. :goto_0
  1169. if-lt p2, p1, :cond_1
  1170. invoke-virtual {p0, p2}, Ljava/lang/String;->charAt(I)C
  1171. move-result v0
  1172. const/16 v1, 0x9
  1173. if-eq v0, v1, :cond_0
  1174. const/16 v1, 0xa
  1175. if-eq v0, v1, :cond_0
  1176. const/16 v1, 0xc
  1177. if-eq v0, v1, :cond_0
  1178. const/16 v1, 0xd
  1179. if-eq v0, v1, :cond_0
  1180. const/16 v1, 0x20
  1181. if-eq v0, v1, :cond_0
  1182. add-int/lit8 p2, p2, 0x1
  1183. return p2
  1184. :cond_0
  1185. add-int/lit8 p2, p2, -0x1
  1186. goto :goto_0
  1187. :cond_1
  1188. return p1
  1189. .end method
  1190. .method public static threadFactory(Ljava/lang/String;Z)Ljava/util/concurrent/ThreadFactory;
  1191. .locals 1
  1192. new-instance v0, Lokhttp3/internal/Util$2;
  1193. invoke-direct {v0, p0, p1}, Lokhttp3/internal/Util$2;-><init>(Ljava/lang/String;Z)V
  1194. return-object v0
  1195. .end method
  1196. .method public static toHumanReadableAscii(Ljava/lang/String;)Ljava/lang/String;
  1197. .locals 7
  1198. invoke-virtual {p0}, Ljava/lang/String;->length()I
  1199. move-result v0
  1200. const/4 v1, 0x0
  1201. const/4 v2, 0x0
  1202. :goto_0
  1203. if-ge v2, v0, :cond_3
  1204. invoke-virtual {p0, v2}, Ljava/lang/String;->codePointAt(I)I
  1205. move-result v3
  1206. const/16 v4, 0x7f
  1207. const/16 v5, 0x1f
  1208. if-le v3, v5, :cond_0
  1209. if-ge v3, v4, :cond_0
  1210. invoke-static {v3}, Ljava/lang/Character;->charCount(I)I
  1211. move-result v3
  1212. add-int/2addr v2, v3
  1213. goto :goto_0
  1214. :cond_0
  1215. new-instance v3, Lokio/Buffer;
  1216. invoke-direct {v3}, Lokio/Buffer;-><init>()V
  1217. invoke-virtual {v3, p0, v1, v2}, Lokio/Buffer;->writeUtf8(Ljava/lang/String;II)Lokio/Buffer;
  1218. :goto_1
  1219. if-ge v2, v0, :cond_2
  1220. invoke-virtual {p0, v2}, Ljava/lang/String;->codePointAt(I)I
  1221. move-result v1
  1222. if-le v1, v5, :cond_1
  1223. if-ge v1, v4, :cond_1
  1224. move v6, v1
  1225. goto :goto_2
  1226. :cond_1
  1227. const/16 v6, 0x3f
  1228. :goto_2
  1229. invoke-virtual {v3, v6}, Lokio/Buffer;->writeUtf8CodePoint(I)Lokio/Buffer;
  1230. invoke-static {v1}, Ljava/lang/Character;->charCount(I)I
  1231. move-result v1
  1232. add-int/2addr v2, v1
  1233. goto :goto_1
  1234. :cond_2
  1235. invoke-virtual {v3}, Lokio/Buffer;->readUtf8()Ljava/lang/String;
  1236. move-result-object p0
  1237. :cond_3
  1238. return-object p0
  1239. .end method
  1240. .method public static trimSubstring(Ljava/lang/String;II)Ljava/lang/String;
  1241. .locals 0
  1242. invoke-static {p0, p1, p2}, Lokhttp3/internal/Util;->skipLeadingAsciiWhitespace(Ljava/lang/String;II)I
  1243. move-result p1
  1244. invoke-static {p0, p1, p2}, Lokhttp3/internal/Util;->skipTrailingAsciiWhitespace(Ljava/lang/String;II)I
  1245. move-result p2
  1246. invoke-virtual {p0, p1, p2}, Ljava/lang/String;->substring(II)Ljava/lang/String;
  1247. move-result-object p0
  1248. return-object p0
  1249. .end method
  1250. .method public static verifyAsIpAddress(Ljava/lang/String;)Z
  1251. .locals 1
  1252. sget-object v0, Lokhttp3/internal/Util;->VERIFY_AS_IP_ADDRESS:Ljava/util/regex/Pattern;
  1253. invoke-virtual {v0, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
  1254. move-result-object p0
  1255. invoke-virtual {p0}, Ljava/util/regex/Matcher;->matches()Z
  1256. move-result p0
  1257. return p0
  1258. .end method