ByteString.smali 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970
  1. .class public Lokio/ByteString;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Ljava/io/Serializable;
  6. .implements Ljava/lang/Comparable;
  7. # annotations
  8. .annotation system Ldalvik/annotation/Signature;
  9. value = {
  10. "Ljava/lang/Object;",
  11. "Ljava/io/Serializable;",
  12. "Ljava/lang/Comparable<",
  13. "Lokio/ByteString;",
  14. ">;"
  15. }
  16. .end annotation
  17. # static fields
  18. .field public static final EMPTY:Lokio/ByteString;
  19. .field static final HEX_DIGITS:[C
  20. .field private static final serialVersionUID:J = 0x1L
  21. # instance fields
  22. .field final data:[B
  23. .field transient hashCode:I
  24. .field transient utf8:Ljava/lang/String;
  25. # direct methods
  26. .method static constructor <clinit>()V
  27. .locals 1
  28. const/16 v0, 0x10
  29. new-array v0, v0, [C
  30. fill-array-data v0, :array_0
  31. sput-object v0, Lokio/ByteString;->HEX_DIGITS:[C
  32. const/4 v0, 0x0
  33. new-array v0, v0, [B
  34. invoke-static {v0}, Lokio/ByteString;->of([B)Lokio/ByteString;
  35. move-result-object v0
  36. sput-object v0, Lokio/ByteString;->EMPTY:Lokio/ByteString;
  37. return-void
  38. nop
  39. :array_0
  40. .array-data 2
  41. 0x30s
  42. 0x31s
  43. 0x32s
  44. 0x33s
  45. 0x34s
  46. 0x35s
  47. 0x36s
  48. 0x37s
  49. 0x38s
  50. 0x39s
  51. 0x61s
  52. 0x62s
  53. 0x63s
  54. 0x64s
  55. 0x65s
  56. 0x66s
  57. .end array-data
  58. .end method
  59. .method constructor <init>([B)V
  60. .locals 0
  61. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  62. iput-object p1, p0, Lokio/ByteString;->data:[B
  63. return-void
  64. .end method
  65. .method static codePointIndexToCharIndex(Ljava/lang/String;I)I
  66. .locals 5
  67. invoke-virtual {p0}, Ljava/lang/String;->length()I
  68. move-result v0
  69. const/4 v1, 0x0
  70. const/4 v2, 0x0
  71. :goto_0
  72. if-ge v1, v0, :cond_4
  73. if-ne v2, p1, :cond_0
  74. return v1
  75. :cond_0
  76. invoke-virtual {p0, v1}, Ljava/lang/String;->codePointAt(I)I
  77. move-result v3
  78. invoke-static {v3}, Ljava/lang/Character;->isISOControl(I)Z
  79. move-result v4
  80. if-eqz v4, :cond_1
  81. const/16 v4, 0xa
  82. if-eq v3, v4, :cond_1
  83. const/16 v4, 0xd
  84. if-ne v3, v4, :cond_2
  85. :cond_1
  86. const v4, 0xfffd
  87. if-ne v3, v4, :cond_3
  88. :cond_2
  89. const/4 p0, -0x1
  90. return p0
  91. :cond_3
  92. add-int/lit8 v2, v2, 0x1
  93. invoke-static {v3}, Ljava/lang/Character;->charCount(I)I
  94. move-result v3
  95. add-int/2addr v1, v3
  96. goto :goto_0
  97. :cond_4
  98. invoke-virtual {p0}, Ljava/lang/String;->length()I
  99. move-result p0
  100. return p0
  101. .end method
  102. .method public static decodeBase64(Ljava/lang/String;)Lokio/ByteString;
  103. .locals 1
  104. if-eqz p0, :cond_1
  105. invoke-static {p0}, Lokio/Base64;->decode(Ljava/lang/String;)[B
  106. move-result-object p0
  107. if-eqz p0, :cond_0
  108. new-instance v0, Lokio/ByteString;
  109. invoke-direct {v0, p0}, Lokio/ByteString;-><init>([B)V
  110. goto :goto_0
  111. :cond_0
  112. const/4 v0, 0x0
  113. :goto_0
  114. return-object v0
  115. :cond_1
  116. new-instance p0, Ljava/lang/IllegalArgumentException;
  117. const-string v0, "base64 == null"
  118. invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  119. throw p0
  120. .end method
  121. .method public static decodeHex(Ljava/lang/String;)Lokio/ByteString;
  122. .locals 4
  123. if-eqz p0, :cond_2
  124. invoke-virtual {p0}, Ljava/lang/String;->length()I
  125. move-result v0
  126. rem-int/lit8 v0, v0, 0x2
  127. if-nez v0, :cond_1
  128. invoke-virtual {p0}, Ljava/lang/String;->length()I
  129. move-result v0
  130. div-int/lit8 v0, v0, 0x2
  131. new-array v0, v0, [B
  132. const/4 v1, 0x0
  133. :goto_0
  134. array-length v2, v0
  135. if-ge v1, v2, :cond_0
  136. mul-int/lit8 v2, v1, 0x2
  137. invoke-virtual {p0, v2}, Ljava/lang/String;->charAt(I)C
  138. move-result v3
  139. invoke-static {v3}, Lokio/ByteString;->decodeHexDigit(C)I
  140. move-result v3
  141. shl-int/lit8 v3, v3, 0x4
  142. add-int/lit8 v2, v2, 0x1
  143. invoke-virtual {p0, v2}, Ljava/lang/String;->charAt(I)C
  144. move-result v2
  145. invoke-static {v2}, Lokio/ByteString;->decodeHexDigit(C)I
  146. move-result v2
  147. add-int/2addr v3, v2
  148. int-to-byte v2, v3
  149. aput-byte v2, v0, v1
  150. add-int/lit8 v1, v1, 0x1
  151. goto :goto_0
  152. :cond_0
  153. invoke-static {v0}, Lokio/ByteString;->of([B)Lokio/ByteString;
  154. move-result-object p0
  155. return-object p0
  156. :cond_1
  157. new-instance v0, Ljava/lang/IllegalArgumentException;
  158. new-instance v1, Ljava/lang/StringBuilder;
  159. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  160. const-string v2, "Unexpected hex string: "
  161. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  162. invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  163. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  164. move-result-object p0
  165. invoke-direct {v0, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  166. throw v0
  167. :cond_2
  168. new-instance p0, Ljava/lang/IllegalArgumentException;
  169. const-string v0, "hex == null"
  170. invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  171. goto :goto_2
  172. :goto_1
  173. throw p0
  174. :goto_2
  175. goto :goto_1
  176. .end method
  177. .method private static decodeHexDigit(C)I
  178. .locals 3
  179. const/16 v0, 0x30
  180. if-lt p0, v0, :cond_0
  181. const/16 v1, 0x39
  182. if-gt p0, v1, :cond_0
  183. sub-int/2addr p0, v0
  184. return p0
  185. :cond_0
  186. const/16 v0, 0x61
  187. if-lt p0, v0, :cond_1
  188. const/16 v1, 0x66
  189. if-gt p0, v1, :cond_1
  190. :goto_0
  191. sub-int/2addr p0, v0
  192. add-int/lit8 p0, p0, 0xa
  193. return p0
  194. :cond_1
  195. const/16 v0, 0x41
  196. if-lt p0, v0, :cond_2
  197. const/16 v1, 0x46
  198. if-gt p0, v1, :cond_2
  199. goto :goto_0
  200. :cond_2
  201. new-instance v0, Ljava/lang/IllegalArgumentException;
  202. new-instance v1, Ljava/lang/StringBuilder;
  203. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  204. const-string v2, "Unexpected hex digit: "
  205. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  206. invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
  207. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  208. move-result-object p0
  209. invoke-direct {v0, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  210. goto :goto_2
  211. :goto_1
  212. throw v0
  213. :goto_2
  214. goto :goto_1
  215. .end method
  216. .method private digest(Ljava/lang/String;)Lokio/ByteString;
  217. .locals 1
  218. :try_start_0
  219. invoke-static {p1}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;
  220. move-result-object p1
  221. iget-object v0, p0, Lokio/ByteString;->data:[B
  222. invoke-virtual {p1, v0}, Ljava/security/MessageDigest;->digest([B)[B
  223. move-result-object p1
  224. invoke-static {p1}, Lokio/ByteString;->of([B)Lokio/ByteString;
  225. move-result-object p1
  226. :try_end_0
  227. .catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_0} :catch_0
  228. return-object p1
  229. :catch_0
  230. move-exception p1
  231. new-instance v0, Ljava/lang/AssertionError;
  232. invoke-direct {v0, p1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
  233. throw v0
  234. .end method
  235. .method public static encodeString(Ljava/lang/String;Ljava/nio/charset/Charset;)Lokio/ByteString;
  236. .locals 1
  237. if-eqz p0, :cond_1
  238. if-eqz p1, :cond_0
  239. new-instance v0, Lokio/ByteString;
  240. invoke-virtual {p0, p1}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B
  241. move-result-object p0
  242. invoke-direct {v0, p0}, Lokio/ByteString;-><init>([B)V
  243. return-object v0
  244. :cond_0
  245. new-instance p0, Ljava/lang/IllegalArgumentException;
  246. const-string p1, "charset == null"
  247. invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  248. throw p0
  249. :cond_1
  250. new-instance p0, Ljava/lang/IllegalArgumentException;
  251. const-string p1, "s == null"
  252. invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  253. throw p0
  254. .end method
  255. .method public static encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
  256. .locals 2
  257. if-eqz p0, :cond_0
  258. new-instance v0, Lokio/ByteString;
  259. sget-object v1, Lokio/Util;->UTF_8:Ljava/nio/charset/Charset;
  260. invoke-virtual {p0, v1}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B
  261. move-result-object v1
  262. invoke-direct {v0, v1}, Lokio/ByteString;-><init>([B)V
  263. iput-object p0, v0, Lokio/ByteString;->utf8:Ljava/lang/String;
  264. return-object v0
  265. :cond_0
  266. new-instance p0, Ljava/lang/IllegalArgumentException;
  267. const-string v0, "s == null"
  268. invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  269. throw p0
  270. .end method
  271. .method private hmac(Ljava/lang/String;Lokio/ByteString;)Lokio/ByteString;
  272. .locals 2
  273. :try_start_0
  274. invoke-static {p1}, Ljavax/crypto/Mac;->getInstance(Ljava/lang/String;)Ljavax/crypto/Mac;
  275. move-result-object v0
  276. new-instance v1, Ljavax/crypto/spec/SecretKeySpec;
  277. invoke-virtual {p2}, Lokio/ByteString;->toByteArray()[B
  278. move-result-object p2
  279. invoke-direct {v1, p2, p1}, Ljavax/crypto/spec/SecretKeySpec;-><init>([BLjava/lang/String;)V
  280. invoke-virtual {v0, v1}, Ljavax/crypto/Mac;->init(Ljava/security/Key;)V
  281. iget-object p1, p0, Lokio/ByteString;->data:[B
  282. invoke-virtual {v0, p1}, Ljavax/crypto/Mac;->doFinal([B)[B
  283. move-result-object p1
  284. invoke-static {p1}, Lokio/ByteString;->of([B)Lokio/ByteString;
  285. move-result-object p1
  286. :try_end_0
  287. .catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_0} :catch_1
  288. .catch Ljava/security/InvalidKeyException; {:try_start_0 .. :try_end_0} :catch_0
  289. return-object p1
  290. :catch_0
  291. move-exception p1
  292. new-instance p2, Ljava/lang/IllegalArgumentException;
  293. invoke-direct {p2, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/Throwable;)V
  294. throw p2
  295. :catch_1
  296. move-exception p1
  297. new-instance p2, Ljava/lang/AssertionError;
  298. invoke-direct {p2, p1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
  299. throw p2
  300. .end method
  301. .method public static of(Ljava/nio/ByteBuffer;)Lokio/ByteString;
  302. .locals 1
  303. if-eqz p0, :cond_0
  304. invoke-virtual {p0}, Ljava/nio/ByteBuffer;->remaining()I
  305. move-result v0
  306. new-array v0, v0, [B
  307. invoke-virtual {p0, v0}, Ljava/nio/ByteBuffer;->get([B)Ljava/nio/ByteBuffer;
  308. new-instance p0, Lokio/ByteString;
  309. invoke-direct {p0, v0}, Lokio/ByteString;-><init>([B)V
  310. return-object p0
  311. :cond_0
  312. new-instance p0, Ljava/lang/IllegalArgumentException;
  313. const-string v0, "data == null"
  314. invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  315. throw p0
  316. .end method
  317. .method public static varargs of([B)Lokio/ByteString;
  318. .locals 1
  319. if-eqz p0, :cond_0
  320. new-instance v0, Lokio/ByteString;
  321. invoke-virtual {p0}, [B->clone()Ljava/lang/Object;
  322. move-result-object p0
  323. check-cast p0, [B
  324. invoke-direct {v0, p0}, Lokio/ByteString;-><init>([B)V
  325. return-object v0
  326. :cond_0
  327. new-instance p0, Ljava/lang/IllegalArgumentException;
  328. const-string v0, "data == null"
  329. invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  330. throw p0
  331. .end method
  332. .method public static of([BII)Lokio/ByteString;
  333. .locals 7
  334. if-eqz p0, :cond_0
  335. array-length v0, p0
  336. int-to-long v1, v0
  337. int-to-long v3, p1
  338. int-to-long v5, p2
  339. invoke-static/range {v1 .. v6}, Lokio/Util;->checkOffsetAndCount(JJJ)V
  340. new-array v0, p2, [B
  341. const/4 v1, 0x0
  342. invoke-static {p0, p1, v0, v1, p2}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
  343. new-instance p0, Lokio/ByteString;
  344. invoke-direct {p0, v0}, Lokio/ByteString;-><init>([B)V
  345. return-object p0
  346. :cond_0
  347. new-instance p0, Ljava/lang/IllegalArgumentException;
  348. const-string p1, "data == null"
  349. invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  350. throw p0
  351. .end method
  352. .method public static read(Ljava/io/InputStream;I)Lokio/ByteString;
  353. .locals 4
  354. .annotation system Ldalvik/annotation/Throws;
  355. value = {
  356. Ljava/io/IOException;
  357. }
  358. .end annotation
  359. if-eqz p0, :cond_3
  360. if-ltz p1, :cond_2
  361. new-array v0, p1, [B
  362. const/4 v1, 0x0
  363. :goto_0
  364. if-ge v1, p1, :cond_1
  365. sub-int v2, p1, v1
  366. invoke-virtual {p0, v0, v1, v2}, Ljava/io/InputStream;->read([BII)I
  367. move-result v2
  368. const/4 v3, -0x1
  369. if-eq v2, v3, :cond_0
  370. add-int/2addr v1, v2
  371. goto :goto_0
  372. :cond_0
  373. new-instance p0, Ljava/io/EOFException;
  374. invoke-direct {p0}, Ljava/io/EOFException;-><init>()V
  375. throw p0
  376. :cond_1
  377. new-instance p0, Lokio/ByteString;
  378. invoke-direct {p0, v0}, Lokio/ByteString;-><init>([B)V
  379. return-object p0
  380. :cond_2
  381. new-instance p0, Ljava/lang/IllegalArgumentException;
  382. new-instance v0, Ljava/lang/StringBuilder;
  383. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  384. const-string v1, "byteCount < 0: "
  385. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  386. invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  387. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  388. move-result-object p1
  389. invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  390. throw p0
  391. :cond_3
  392. new-instance p0, Ljava/lang/IllegalArgumentException;
  393. const-string p1, "in == null"
  394. invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  395. goto :goto_2
  396. :goto_1
  397. throw p0
  398. :goto_2
  399. goto :goto_1
  400. .end method
  401. .method private readObject(Ljava/io/ObjectInputStream;)V
  402. .locals 2
  403. .annotation system Ldalvik/annotation/Throws;
  404. value = {
  405. Ljava/io/IOException;
  406. }
  407. .end annotation
  408. invoke-virtual {p1}, Ljava/io/ObjectInputStream;->readInt()I
  409. move-result v0
  410. invoke-static {p1, v0}, Lokio/ByteString;->read(Ljava/io/InputStream;I)Lokio/ByteString;
  411. move-result-object p1
  412. :try_start_0
  413. const-class v0, Lokio/ByteString;
  414. :try_end_0
  415. .catch Ljava/lang/NoSuchFieldException; {:try_start_0 .. :try_end_0} :catch_1
  416. .catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_0
  417. const-string v1, "data"
  418. :try_start_1
  419. invoke-virtual {v0, v1}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
  420. move-result-object v0
  421. const/4 v1, 0x1
  422. invoke-virtual {v0, v1}, Ljava/lang/reflect/Field;->setAccessible(Z)V
  423. iget-object p1, p1, Lokio/ByteString;->data:[B
  424. invoke-virtual {v0, p0, p1}, Ljava/lang/reflect/Field;->set(Ljava/lang/Object;Ljava/lang/Object;)V
  425. :try_end_1
  426. .catch Ljava/lang/NoSuchFieldException; {:try_start_1 .. :try_end_1} :catch_1
  427. .catch Ljava/lang/IllegalAccessException; {:try_start_1 .. :try_end_1} :catch_0
  428. return-void
  429. :catch_0
  430. new-instance p1, Ljava/lang/AssertionError;
  431. invoke-direct {p1}, Ljava/lang/AssertionError;-><init>()V
  432. throw p1
  433. :catch_1
  434. new-instance p1, Ljava/lang/AssertionError;
  435. invoke-direct {p1}, Ljava/lang/AssertionError;-><init>()V
  436. throw p1
  437. .end method
  438. .method private writeObject(Ljava/io/ObjectOutputStream;)V
  439. .locals 1
  440. .annotation system Ldalvik/annotation/Throws;
  441. value = {
  442. Ljava/io/IOException;
  443. }
  444. .end annotation
  445. iget-object v0, p0, Lokio/ByteString;->data:[B
  446. array-length v0, v0
  447. invoke-virtual {p1, v0}, Ljava/io/ObjectOutputStream;->writeInt(I)V
  448. iget-object v0, p0, Lokio/ByteString;->data:[B
  449. invoke-virtual {p1, v0}, Ljava/io/ObjectOutputStream;->write([B)V
  450. return-void
  451. .end method
  452. # virtual methods
  453. .method public asByteBuffer()Ljava/nio/ByteBuffer;
  454. .locals 1
  455. iget-object v0, p0, Lokio/ByteString;->data:[B
  456. invoke-static {v0}, Ljava/nio/ByteBuffer;->wrap([B)Ljava/nio/ByteBuffer;
  457. move-result-object v0
  458. invoke-virtual {v0}, Ljava/nio/ByteBuffer;->asReadOnlyBuffer()Ljava/nio/ByteBuffer;
  459. move-result-object v0
  460. return-object v0
  461. .end method
  462. .method public base64()Ljava/lang/String;
  463. .locals 1
  464. iget-object v0, p0, Lokio/ByteString;->data:[B
  465. invoke-static {v0}, Lokio/Base64;->encode([B)Ljava/lang/String;
  466. move-result-object v0
  467. return-object v0
  468. .end method
  469. .method public base64Url()Ljava/lang/String;
  470. .locals 1
  471. iget-object v0, p0, Lokio/ByteString;->data:[B
  472. invoke-static {v0}, Lokio/Base64;->encodeUrl([B)Ljava/lang/String;
  473. move-result-object v0
  474. return-object v0
  475. .end method
  476. .method public bridge synthetic compareTo(Ljava/lang/Object;)I
  477. .locals 0
  478. check-cast p1, Lokio/ByteString;
  479. invoke-virtual {p0, p1}, Lokio/ByteString;->compareTo(Lokio/ByteString;)I
  480. move-result p1
  481. return p1
  482. .end method
  483. .method public compareTo(Lokio/ByteString;)I
  484. .locals 9
  485. invoke-virtual {p0}, Lokio/ByteString;->size()I
  486. move-result v0
  487. invoke-virtual {p1}, Lokio/ByteString;->size()I
  488. move-result v1
  489. invoke-static {v0, v1}, Ljava/lang/Math;->min(II)I
  490. move-result v2
  491. const/4 v3, 0x0
  492. const/4 v4, 0x0
  493. :goto_0
  494. const/4 v5, -0x1
  495. const/4 v6, 0x1
  496. if-ge v4, v2, :cond_2
  497. invoke-virtual {p0, v4}, Lokio/ByteString;->getByte(I)B
  498. move-result v7
  499. and-int/lit16 v7, v7, 0xff
  500. invoke-virtual {p1, v4}, Lokio/ByteString;->getByte(I)B
  501. move-result v8
  502. and-int/lit16 v8, v8, 0xff
  503. if-ne v7, v8, :cond_0
  504. add-int/lit8 v4, v4, 0x1
  505. goto :goto_0
  506. :cond_0
  507. if-ge v7, v8, :cond_1
  508. goto :goto_1
  509. :cond_1
  510. const/4 v5, 0x1
  511. :goto_1
  512. return v5
  513. :cond_2
  514. if-ne v0, v1, :cond_3
  515. return v3
  516. :cond_3
  517. if-ge v0, v1, :cond_4
  518. goto :goto_2
  519. :cond_4
  520. const/4 v5, 0x1
  521. :goto_2
  522. return v5
  523. .end method
  524. .method public final endsWith(Lokio/ByteString;)Z
  525. .locals 3
  526. invoke-virtual {p0}, Lokio/ByteString;->size()I
  527. move-result v0
  528. invoke-virtual {p1}, Lokio/ByteString;->size()I
  529. move-result v1
  530. sub-int/2addr v0, v1
  531. invoke-virtual {p1}, Lokio/ByteString;->size()I
  532. move-result v1
  533. const/4 v2, 0x0
  534. invoke-virtual {p0, v0, p1, v2, v1}, Lokio/ByteString;->rangeEquals(ILokio/ByteString;II)Z
  535. move-result p1
  536. return p1
  537. .end method
  538. .method public final endsWith([B)Z
  539. .locals 3
  540. invoke-virtual {p0}, Lokio/ByteString;->size()I
  541. move-result v0
  542. array-length v1, p1
  543. sub-int/2addr v0, v1
  544. array-length v1, p1
  545. const/4 v2, 0x0
  546. invoke-virtual {p0, v0, p1, v2, v1}, Lokio/ByteString;->rangeEquals(I[BII)Z
  547. move-result p1
  548. return p1
  549. .end method
  550. .method public equals(Ljava/lang/Object;)Z
  551. .locals 5
  552. const/4 v0, 0x1
  553. if-ne p1, p0, :cond_0
  554. return v0
  555. :cond_0
  556. instance-of v1, p1, Lokio/ByteString;
  557. const/4 v2, 0x0
  558. if-eqz v1, :cond_1
  559. check-cast p1, Lokio/ByteString;
  560. invoke-virtual {p1}, Lokio/ByteString;->size()I
  561. move-result v1
  562. iget-object v3, p0, Lokio/ByteString;->data:[B
  563. array-length v4, v3
  564. if-ne v1, v4, :cond_1
  565. array-length v1, v3
  566. invoke-virtual {p1, v2, v3, v2, v1}, Lokio/ByteString;->rangeEquals(I[BII)Z
  567. move-result p1
  568. if-eqz p1, :cond_1
  569. goto :goto_0
  570. :cond_1
  571. const/4 v0, 0x0
  572. :goto_0
  573. return v0
  574. .end method
  575. .method public getByte(I)B
  576. .locals 1
  577. iget-object v0, p0, Lokio/ByteString;->data:[B
  578. aget-byte p1, v0, p1
  579. return p1
  580. .end method
  581. .method public hashCode()I
  582. .locals 1
  583. iget v0, p0, Lokio/ByteString;->hashCode:I
  584. if-eqz v0, :cond_0
  585. goto :goto_0
  586. :cond_0
  587. iget-object v0, p0, Lokio/ByteString;->data:[B
  588. invoke-static {v0}, Ljava/util/Arrays;->hashCode([B)I
  589. move-result v0
  590. iput v0, p0, Lokio/ByteString;->hashCode:I
  591. :goto_0
  592. return v0
  593. .end method
  594. .method public hex()Ljava/lang/String;
  595. .locals 9
  596. iget-object v0, p0, Lokio/ByteString;->data:[B
  597. array-length v1, v0
  598. mul-int/lit8 v1, v1, 0x2
  599. new-array v1, v1, [C
  600. array-length v2, v0
  601. const/4 v3, 0x0
  602. const/4 v4, 0x0
  603. :goto_0
  604. if-ge v3, v2, :cond_0
  605. aget-byte v5, v0, v3
  606. add-int/lit8 v6, v4, 0x1
  607. sget-object v7, Lokio/ByteString;->HEX_DIGITS:[C
  608. shr-int/lit8 v8, v5, 0x4
  609. and-int/lit8 v8, v8, 0xf
  610. aget-char v8, v7, v8
  611. aput-char v8, v1, v4
  612. add-int/lit8 v4, v6, 0x1
  613. and-int/lit8 v5, v5, 0xf
  614. aget-char v5, v7, v5
  615. aput-char v5, v1, v6
  616. add-int/lit8 v3, v3, 0x1
  617. goto :goto_0
  618. :cond_0
  619. new-instance v0, Ljava/lang/String;
  620. invoke-direct {v0, v1}, Ljava/lang/String;-><init>([C)V
  621. return-object v0
  622. .end method
  623. .method public hmacSha1(Lokio/ByteString;)Lokio/ByteString;
  624. .locals 1
  625. const-string v0, "HmacSHA1"
  626. invoke-direct {p0, v0, p1}, Lokio/ByteString;->hmac(Ljava/lang/String;Lokio/ByteString;)Lokio/ByteString;
  627. move-result-object p1
  628. return-object p1
  629. .end method
  630. .method public hmacSha256(Lokio/ByteString;)Lokio/ByteString;
  631. .locals 1
  632. const-string v0, "HmacSHA256"
  633. invoke-direct {p0, v0, p1}, Lokio/ByteString;->hmac(Ljava/lang/String;Lokio/ByteString;)Lokio/ByteString;
  634. move-result-object p1
  635. return-object p1
  636. .end method
  637. .method public hmacSha512(Lokio/ByteString;)Lokio/ByteString;
  638. .locals 1
  639. const-string v0, "HmacSHA512"
  640. invoke-direct {p0, v0, p1}, Lokio/ByteString;->hmac(Ljava/lang/String;Lokio/ByteString;)Lokio/ByteString;
  641. move-result-object p1
  642. return-object p1
  643. .end method
  644. .method public final indexOf(Lokio/ByteString;)I
  645. .locals 1
  646. invoke-virtual {p1}, Lokio/ByteString;->internalArray()[B
  647. move-result-object p1
  648. const/4 v0, 0x0
  649. invoke-virtual {p0, p1, v0}, Lokio/ByteString;->indexOf([BI)I
  650. move-result p1
  651. return p1
  652. .end method
  653. .method public final indexOf(Lokio/ByteString;I)I
  654. .locals 0
  655. invoke-virtual {p1}, Lokio/ByteString;->internalArray()[B
  656. move-result-object p1
  657. invoke-virtual {p0, p1, p2}, Lokio/ByteString;->indexOf([BI)I
  658. move-result p1
  659. return p1
  660. .end method
  661. .method public final indexOf([B)I
  662. .locals 1
  663. const/4 v0, 0x0
  664. invoke-virtual {p0, p1, v0}, Lokio/ByteString;->indexOf([BI)I
  665. move-result p1
  666. return p1
  667. .end method
  668. .method public indexOf([BI)I
  669. .locals 4
  670. const/4 v0, 0x0
  671. invoke-static {p2, v0}, Ljava/lang/Math;->max(II)I
  672. move-result p2
  673. iget-object v1, p0, Lokio/ByteString;->data:[B
  674. array-length v1, v1
  675. array-length v2, p1
  676. sub-int/2addr v1, v2
  677. :goto_0
  678. if-gt p2, v1, :cond_1
  679. iget-object v2, p0, Lokio/ByteString;->data:[B
  680. array-length v3, p1
  681. invoke-static {v2, p2, p1, v0, v3}, Lokio/Util;->arrayRangeEquals([BI[BII)Z
  682. move-result v2
  683. if-eqz v2, :cond_0
  684. return p2
  685. :cond_0
  686. add-int/lit8 p2, p2, 0x1
  687. goto :goto_0
  688. :cond_1
  689. const/4 p1, -0x1
  690. return p1
  691. .end method
  692. .method internalArray()[B
  693. .locals 1
  694. iget-object v0, p0, Lokio/ByteString;->data:[B
  695. return-object v0
  696. .end method
  697. .method public final lastIndexOf(Lokio/ByteString;)I
  698. .locals 1
  699. invoke-virtual {p1}, Lokio/ByteString;->internalArray()[B
  700. move-result-object p1
  701. invoke-virtual {p0}, Lokio/ByteString;->size()I
  702. move-result v0
  703. invoke-virtual {p0, p1, v0}, Lokio/ByteString;->lastIndexOf([BI)I
  704. move-result p1
  705. return p1
  706. .end method
  707. .method public final lastIndexOf(Lokio/ByteString;I)I
  708. .locals 0
  709. invoke-virtual {p1}, Lokio/ByteString;->internalArray()[B
  710. move-result-object p1
  711. invoke-virtual {p0, p1, p2}, Lokio/ByteString;->lastIndexOf([BI)I
  712. move-result p1
  713. return p1
  714. .end method
  715. .method public final lastIndexOf([B)I
  716. .locals 1
  717. invoke-virtual {p0}, Lokio/ByteString;->size()I
  718. move-result v0
  719. invoke-virtual {p0, p1, v0}, Lokio/ByteString;->lastIndexOf([BI)I
  720. move-result p1
  721. return p1
  722. .end method
  723. .method public lastIndexOf([BI)I
  724. .locals 3
  725. iget-object v0, p0, Lokio/ByteString;->data:[B
  726. array-length v0, v0
  727. array-length v1, p1
  728. sub-int/2addr v0, v1
  729. invoke-static {p2, v0}, Ljava/lang/Math;->min(II)I
  730. move-result p2
  731. :goto_0
  732. if-ltz p2, :cond_1
  733. iget-object v0, p0, Lokio/ByteString;->data:[B
  734. const/4 v1, 0x0
  735. array-length v2, p1
  736. invoke-static {v0, p2, p1, v1, v2}, Lokio/Util;->arrayRangeEquals([BI[BII)Z
  737. move-result v0
  738. if-eqz v0, :cond_0
  739. return p2
  740. :cond_0
  741. add-int/lit8 p2, p2, -0x1
  742. goto :goto_0
  743. :cond_1
  744. const/4 p1, -0x1
  745. return p1
  746. .end method
  747. .method public md5()Lokio/ByteString;
  748. .locals 1
  749. const-string v0, "MD5"
  750. invoke-direct {p0, v0}, Lokio/ByteString;->digest(Ljava/lang/String;)Lokio/ByteString;
  751. move-result-object v0
  752. return-object v0
  753. .end method
  754. .method public rangeEquals(ILokio/ByteString;II)Z
  755. .locals 1
  756. iget-object v0, p0, Lokio/ByteString;->data:[B
  757. invoke-virtual {p2, p3, v0, p1, p4}, Lokio/ByteString;->rangeEquals(I[BII)Z
  758. move-result p1
  759. return p1
  760. .end method
  761. .method public rangeEquals(I[BII)Z
  762. .locals 2
  763. if-ltz p1, :cond_0
  764. iget-object v0, p0, Lokio/ByteString;->data:[B
  765. array-length v1, v0
  766. sub-int/2addr v1, p4
  767. if-gt p1, v1, :cond_0
  768. if-ltz p3, :cond_0
  769. array-length v1, p2
  770. sub-int/2addr v1, p4
  771. if-gt p3, v1, :cond_0
  772. invoke-static {v0, p1, p2, p3, p4}, Lokio/Util;->arrayRangeEquals([BI[BII)Z
  773. move-result p1
  774. if-eqz p1, :cond_0
  775. const/4 p1, 0x1
  776. goto :goto_0
  777. :cond_0
  778. const/4 p1, 0x0
  779. :goto_0
  780. return p1
  781. .end method
  782. .method public sha1()Lokio/ByteString;
  783. .locals 1
  784. const-string v0, "SHA-1"
  785. invoke-direct {p0, v0}, Lokio/ByteString;->digest(Ljava/lang/String;)Lokio/ByteString;
  786. move-result-object v0
  787. return-object v0
  788. .end method
  789. .method public sha256()Lokio/ByteString;
  790. .locals 1
  791. const-string v0, "SHA-256"
  792. invoke-direct {p0, v0}, Lokio/ByteString;->digest(Ljava/lang/String;)Lokio/ByteString;
  793. move-result-object v0
  794. return-object v0
  795. .end method
  796. .method public sha512()Lokio/ByteString;
  797. .locals 1
  798. const-string v0, "SHA-512"
  799. invoke-direct {p0, v0}, Lokio/ByteString;->digest(Ljava/lang/String;)Lokio/ByteString;
  800. move-result-object v0
  801. return-object v0
  802. .end method
  803. .method public size()I
  804. .locals 1
  805. iget-object v0, p0, Lokio/ByteString;->data:[B
  806. array-length v0, v0
  807. return v0
  808. .end method
  809. .method public final startsWith(Lokio/ByteString;)Z
  810. .locals 2
  811. invoke-virtual {p1}, Lokio/ByteString;->size()I
  812. move-result v0
  813. const/4 v1, 0x0
  814. invoke-virtual {p0, v1, p1, v1, v0}, Lokio/ByteString;->rangeEquals(ILokio/ByteString;II)Z
  815. move-result p1
  816. return p1
  817. .end method
  818. .method public final startsWith([B)Z
  819. .locals 2
  820. array-length v0, p1
  821. const/4 v1, 0x0
  822. invoke-virtual {p0, v1, p1, v1, v0}, Lokio/ByteString;->rangeEquals(I[BII)Z
  823. move-result p1
  824. return p1
  825. .end method
  826. .method public string(Ljava/nio/charset/Charset;)Ljava/lang/String;
  827. .locals 2
  828. if-eqz p1, :cond_0
  829. new-instance v0, Ljava/lang/String;
  830. iget-object v1, p0, Lokio/ByteString;->data:[B
  831. invoke-direct {v0, v1, p1}, Ljava/lang/String;-><init>([BLjava/nio/charset/Charset;)V
  832. return-object v0
  833. :cond_0
  834. new-instance p1, Ljava/lang/IllegalArgumentException;
  835. const-string v0, "charset == null"
  836. invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  837. throw p1
  838. .end method
  839. .method public substring(I)Lokio/ByteString;
  840. .locals 1
  841. iget-object v0, p0, Lokio/ByteString;->data:[B
  842. array-length v0, v0
  843. invoke-virtual {p0, p1, v0}, Lokio/ByteString;->substring(II)Lokio/ByteString;
  844. move-result-object p1
  845. return-object p1
  846. .end method
  847. .method public substring(II)Lokio/ByteString;
  848. .locals 3
  849. if-ltz p1, :cond_3
  850. iget-object v0, p0, Lokio/ByteString;->data:[B
  851. array-length v1, v0
  852. if-gt p2, v1, :cond_2
  853. sub-int v1, p2, p1
  854. if-ltz v1, :cond_1
  855. if-nez p1, :cond_0
  856. array-length v0, v0
  857. if-ne p2, v0, :cond_0
  858. return-object p0
  859. :cond_0
  860. new-array p2, v1, [B
  861. iget-object v0, p0, Lokio/ByteString;->data:[B
  862. const/4 v2, 0x0
  863. invoke-static {v0, p1, p2, v2, v1}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
  864. new-instance p1, Lokio/ByteString;
  865. invoke-direct {p1, p2}, Lokio/ByteString;-><init>([B)V
  866. return-object p1
  867. :cond_1
  868. new-instance p1, Ljava/lang/IllegalArgumentException;
  869. const-string p2, "endIndex < beginIndex"
  870. invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  871. throw p1
  872. :cond_2
  873. new-instance p1, Ljava/lang/IllegalArgumentException;
  874. new-instance p2, Ljava/lang/StringBuilder;
  875. invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
  876. const-string v0, "endIndex > length("
  877. invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  878. iget-object v0, p0, Lokio/ByteString;->data:[B
  879. array-length v0, v0
  880. invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  881. const-string v0, ")"
  882. invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  883. invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  884. move-result-object p2
  885. invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  886. throw p1
  887. :cond_3
  888. new-instance p1, Ljava/lang/IllegalArgumentException;
  889. const-string p2, "beginIndex < 0"
  890. invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  891. throw p1
  892. .end method
  893. .method public toAsciiLowercase()Lokio/ByteString;
  894. .locals 6
  895. const/4 v0, 0x0
  896. :goto_0
  897. iget-object v1, p0, Lokio/ByteString;->data:[B
  898. array-length v2, v1
  899. if-ge v0, v2, :cond_5
  900. aget-byte v2, v1, v0
  901. const/16 v3, 0x41
  902. if-lt v2, v3, :cond_4
  903. const/16 v4, 0x5a
  904. if-le v2, v4, :cond_0
  905. goto :goto_3
  906. :cond_0
  907. invoke-virtual {v1}, [B->clone()Ljava/lang/Object;
  908. move-result-object v1
  909. check-cast v1, [B
  910. add-int/lit8 v5, v0, 0x1
  911. add-int/lit8 v2, v2, 0x20
  912. int-to-byte v2, v2
  913. aput-byte v2, v1, v0
  914. :goto_1
  915. array-length v0, v1
  916. if-ge v5, v0, :cond_3
  917. aget-byte v0, v1, v5
  918. if-lt v0, v3, :cond_2
  919. if-le v0, v4, :cond_1
  920. goto :goto_2
  921. :cond_1
  922. add-int/lit8 v0, v0, 0x20
  923. int-to-byte v0, v0
  924. aput-byte v0, v1, v5
  925. :cond_2
  926. :goto_2
  927. add-int/lit8 v5, v5, 0x1
  928. goto :goto_1
  929. :cond_3
  930. new-instance v0, Lokio/ByteString;
  931. invoke-direct {v0, v1}, Lokio/ByteString;-><init>([B)V
  932. return-object v0
  933. :cond_4
  934. :goto_3
  935. add-int/lit8 v0, v0, 0x1
  936. goto :goto_0
  937. :cond_5
  938. return-object p0
  939. .end method
  940. .method public toAsciiUppercase()Lokio/ByteString;
  941. .locals 6
  942. const/4 v0, 0x0
  943. :goto_0
  944. iget-object v1, p0, Lokio/ByteString;->data:[B
  945. array-length v2, v1
  946. if-ge v0, v2, :cond_5
  947. aget-byte v2, v1, v0
  948. const/16 v3, 0x61
  949. if-lt v2, v3, :cond_4
  950. const/16 v4, 0x7a
  951. if-le v2, v4, :cond_0
  952. goto :goto_3
  953. :cond_0
  954. invoke-virtual {v1}, [B->clone()Ljava/lang/Object;
  955. move-result-object v1
  956. check-cast v1, [B
  957. add-int/lit8 v5, v0, 0x1
  958. add-int/lit8 v2, v2, -0x20
  959. int-to-byte v2, v2
  960. aput-byte v2, v1, v0
  961. :goto_1
  962. array-length v0, v1
  963. if-ge v5, v0, :cond_3
  964. aget-byte v0, v1, v5
  965. if-lt v0, v3, :cond_2
  966. if-le v0, v4, :cond_1
  967. goto :goto_2
  968. :cond_1
  969. add-int/lit8 v0, v0, -0x20
  970. int-to-byte v0, v0
  971. aput-byte v0, v1, v5
  972. :cond_2
  973. :goto_2
  974. add-int/lit8 v5, v5, 0x1
  975. goto :goto_1
  976. :cond_3
  977. new-instance v0, Lokio/ByteString;
  978. invoke-direct {v0, v1}, Lokio/ByteString;-><init>([B)V
  979. return-object v0
  980. :cond_4
  981. :goto_3
  982. add-int/lit8 v0, v0, 0x1
  983. goto :goto_0
  984. :cond_5
  985. return-object p0
  986. .end method
  987. .method public toByteArray()[B
  988. .locals 1
  989. iget-object v0, p0, Lokio/ByteString;->data:[B
  990. invoke-virtual {v0}, [B->clone()Ljava/lang/Object;
  991. move-result-object v0
  992. check-cast v0, [B
  993. return-object v0
  994. .end method
  995. .method public toString()Ljava/lang/String;
  996. .locals 8
  997. iget-object v0, p0, Lokio/ByteString;->data:[B
  998. array-length v0, v0
  999. if-nez v0, :cond_0
  1000. const-string v0, "[size=0]"
  1001. return-object v0
  1002. :cond_0
  1003. invoke-virtual {p0}, Lokio/ByteString;->utf8()Ljava/lang/String;
  1004. move-result-object v0
  1005. const/16 v1, 0x40
  1006. invoke-static {v0, v1}, Lokio/ByteString;->codePointIndexToCharIndex(Ljava/lang/String;I)I
  1007. move-result v2
  1008. const/4 v3, -0x1
  1009. const-string v4, "\u2026]"
  1010. const-string v5, "[size="
  1011. const-string v6, "]"
  1012. const/4 v7, 0x0
  1013. if-ne v2, v3, :cond_2
  1014. iget-object v0, p0, Lokio/ByteString;->data:[B
  1015. array-length v0, v0
  1016. if-gt v0, v1, :cond_1
  1017. new-instance v0, Ljava/lang/StringBuilder;
  1018. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  1019. const-string v1, "[hex="
  1020. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1021. invoke-virtual {p0}, Lokio/ByteString;->hex()Ljava/lang/String;
  1022. move-result-object v1
  1023. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1024. invoke-virtual {v0, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1025. goto :goto_0
  1026. :cond_1
  1027. new-instance v0, Ljava/lang/StringBuilder;
  1028. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  1029. invoke-virtual {v0, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1030. iget-object v2, p0, Lokio/ByteString;->data:[B
  1031. array-length v2, v2
  1032. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  1033. const-string v2, " hex="
  1034. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1035. invoke-virtual {p0, v7, v1}, Lokio/ByteString;->substring(II)Lokio/ByteString;
  1036. move-result-object v1
  1037. invoke-virtual {v1}, Lokio/ByteString;->hex()Ljava/lang/String;
  1038. move-result-object v1
  1039. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1040. invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1041. :goto_0
  1042. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  1043. move-result-object v0
  1044. return-object v0
  1045. :cond_2
  1046. invoke-virtual {v0, v7, v2}, Ljava/lang/String;->substring(II)Ljava/lang/String;
  1047. move-result-object v1
  1048. const-string v3, "\\"
  1049. const-string v7, "\\\\"
  1050. invoke-virtual {v1, v3, v7}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
  1051. move-result-object v1
  1052. const-string v3, "\n"
  1053. const-string v7, "\\n"
  1054. invoke-virtual {v1, v3, v7}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
  1055. move-result-object v1
  1056. const-string v3, "\r"
  1057. const-string v7, "\\r"
  1058. invoke-virtual {v1, v3, v7}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
  1059. move-result-object v1
  1060. invoke-virtual {v0}, Ljava/lang/String;->length()I
  1061. move-result v0
  1062. if-ge v2, v0, :cond_3
  1063. new-instance v0, Ljava/lang/StringBuilder;
  1064. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  1065. invoke-virtual {v0, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1066. iget-object v2, p0, Lokio/ByteString;->data:[B
  1067. array-length v2, v2
  1068. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  1069. const-string v2, " text="
  1070. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1071. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1072. invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1073. goto :goto_1
  1074. :cond_3
  1075. new-instance v0, Ljava/lang/StringBuilder;
  1076. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  1077. const-string v2, "[text="
  1078. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1079. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1080. invoke-virtual {v0, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1081. :goto_1
  1082. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  1083. move-result-object v0
  1084. return-object v0
  1085. .end method
  1086. .method public utf8()Ljava/lang/String;
  1087. .locals 3
  1088. iget-object v0, p0, Lokio/ByteString;->utf8:Ljava/lang/String;
  1089. if-eqz v0, :cond_0
  1090. goto :goto_0
  1091. :cond_0
  1092. new-instance v0, Ljava/lang/String;
  1093. iget-object v1, p0, Lokio/ByteString;->data:[B
  1094. sget-object v2, Lokio/Util;->UTF_8:Ljava/nio/charset/Charset;
  1095. invoke-direct {v0, v1, v2}, Ljava/lang/String;-><init>([BLjava/nio/charset/Charset;)V
  1096. iput-object v0, p0, Lokio/ByteString;->utf8:Ljava/lang/String;
  1097. :goto_0
  1098. return-object v0
  1099. .end method
  1100. .method public write(Ljava/io/OutputStream;)V
  1101. .locals 1
  1102. .annotation system Ldalvik/annotation/Throws;
  1103. value = {
  1104. Ljava/io/IOException;
  1105. }
  1106. .end annotation
  1107. if-eqz p1, :cond_0
  1108. iget-object v0, p0, Lokio/ByteString;->data:[B
  1109. invoke-virtual {p1, v0}, Ljava/io/OutputStream;->write([B)V
  1110. return-void
  1111. :cond_0
  1112. new-instance p1, Ljava/lang/IllegalArgumentException;
  1113. const-string v0, "out == null"
  1114. invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  1115. throw p1
  1116. .end method
  1117. .method write(Lokio/Buffer;)V
  1118. .locals 3
  1119. iget-object v0, p0, Lokio/ByteString;->data:[B
  1120. array-length v1, v0
  1121. const/4 v2, 0x0
  1122. invoke-virtual {p1, v0, v2, v1}, Lokio/Buffer;->write([BII)Lokio/Buffer;
  1123. return-void
  1124. .end method