PageRenderTime 48ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/QingTingFanBianYi/src/com/alibaba/fastjson/util/Base64.java

https://gitlab.com/qt-prometheus/qt-prometheus
Java | 373 lines | 362 code | 7 blank | 4 comment | 70 complexity | f0b45ee0d4453cf1a9a98d14f062782d MD5 | raw file
  1. package com.alibaba.fastjson.util;
  2. import java.util.Arrays;
  3. public class Base64
  4. {
  5. public static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
  6. public static final int[] IA = new int[256];
  7. static
  8. {
  9. Arrays.fill(IA, -1);
  10. int i = 0;
  11. int j = CA.length;
  12. while (i < j)
  13. {
  14. IA[CA[i]] = i;
  15. i += 1;
  16. }
  17. IA[61] = 0;
  18. }
  19. public static final byte[] decodeFast(String paramString)
  20. {
  21. int m = paramString.length();
  22. if (m == 0)
  23. return new byte[0];
  24. int i = 0;
  25. int j = m - 1;
  26. int n;
  27. while (true)
  28. {
  29. n = j;
  30. if (i >= j)
  31. break;
  32. n = j;
  33. if (IA[(paramString.charAt(i) & 0xFF)] >= 0)
  34. break;
  35. i += 1;
  36. }
  37. while ((n > 0) && (IA[(paramString.charAt(n) & 0xFF)] < 0))
  38. n -= 1;
  39. int k;
  40. int i2;
  41. label151: int i1;
  42. label157: int i3;
  43. byte[] arrayOfByte;
  44. if (paramString.charAt(n) == '=')
  45. if (paramString.charAt(n - 1) == '=')
  46. {
  47. k = 2;
  48. i2 = n - i + 1;
  49. if (m <= 76)
  50. break label403;
  51. if (paramString.charAt(76) != '\r')
  52. break label397;
  53. j = i2 / 78;
  54. i1 = j << 1;
  55. i3 = ((i2 - i1) * 6 >> 3) - k;
  56. arrayOfByte = new byte[i3];
  57. m = 0;
  58. int i4 = i3 / 3;
  59. i2 = 0;
  60. j = i;
  61. i = i2;
  62. label195: if (i >= i4 * 3)
  63. break label409;
  64. int[] arrayOfInt = IA;
  65. int i5 = j + 1;
  66. i2 = arrayOfInt[paramString.charAt(j)];
  67. arrayOfInt = IA;
  68. j = i5 + 1;
  69. i5 = arrayOfInt[paramString.charAt(i5)];
  70. arrayOfInt = IA;
  71. int i6 = j + 1;
  72. int i7 = arrayOfInt[paramString.charAt(j)];
  73. arrayOfInt = IA;
  74. j = i6 + 1;
  75. i5 = i2 << 18 | i5 << 12 | i7 << 6 | arrayOfInt[paramString.charAt(i6)];
  76. i6 = i + 1;
  77. arrayOfByte[i] = ((byte)(i5 >> 16));
  78. i2 = i6 + 1;
  79. arrayOfByte[i6] = ((byte)(i5 >> 8));
  80. arrayOfByte[i2] = ((byte)i5);
  81. i = m;
  82. if (i1 <= 0)
  83. break label519;
  84. m += 1;
  85. i = m;
  86. if (m != 19)
  87. break label519;
  88. i = j + 2;
  89. m = 0;
  90. }
  91. while (true)
  92. {
  93. i2 += 1;
  94. j = i;
  95. i = i2;
  96. break label195;
  97. k = 1;
  98. break;
  99. k = 0;
  100. break;
  101. label397: j = 0;
  102. break label151;
  103. label403: i1 = 0;
  104. break label157;
  105. label409: i1 = i;
  106. i1 = j;
  107. if (i < i3)
  108. {
  109. m = 0;
  110. i1 = 0;
  111. while (j <= n - k)
  112. {
  113. m |= IA[paramString.charAt(j)] << 18 - i1 * 6;
  114. i1 += 1;
  115. j += 1;
  116. }
  117. k = 16;
  118. while (true)
  119. {
  120. i1 = i;
  121. i1 = j;
  122. if (i >= i3)
  123. break;
  124. arrayOfByte[i] = ((byte)(m >> k));
  125. k -= 8;
  126. i += 1;
  127. }
  128. }
  129. return arrayOfByte;
  130. label519: m = i;
  131. i = j;
  132. }
  133. }
  134. public static final byte[] decodeFast(String paramString, int paramInt1, int paramInt2)
  135. {
  136. if (paramInt2 == 0)
  137. return new byte[0];
  138. int i = paramInt1;
  139. int j = paramInt1 + paramInt2 - 1;
  140. paramInt1 = i;
  141. int k;
  142. while (true)
  143. {
  144. k = j;
  145. if (paramInt1 >= j)
  146. break;
  147. k = j;
  148. if (IA[paramString.charAt(paramInt1)] >= 0)
  149. break;
  150. paramInt1 += 1;
  151. }
  152. while ((k > 0) && (IA[paramString.charAt(k)] < 0))
  153. k -= 1;
  154. label139: int m;
  155. label144: int i1;
  156. byte[] arrayOfByte;
  157. int n;
  158. if (paramString.charAt(k) == '=')
  159. if (paramString.charAt(k - 1) == '=')
  160. {
  161. i = 2;
  162. j = k - paramInt1 + 1;
  163. if (paramInt2 <= 76)
  164. break label388;
  165. if (paramString.charAt(76) != '\r')
  166. break label383;
  167. paramInt2 = j / 78;
  168. m = paramInt2 << 1;
  169. i1 = ((j - m) * 6 >> 3) - i;
  170. arrayOfByte = new byte[i1];
  171. j = 0;
  172. int i2 = i1 / 3;
  173. n = 0;
  174. paramInt2 = paramInt1;
  175. paramInt1 = n;
  176. label181: if (paramInt1 >= i2 * 3)
  177. break label394;
  178. int[] arrayOfInt = IA;
  179. int i3 = paramInt2 + 1;
  180. n = arrayOfInt[paramString.charAt(paramInt2)];
  181. arrayOfInt = IA;
  182. paramInt2 = i3 + 1;
  183. i3 = arrayOfInt[paramString.charAt(i3)];
  184. arrayOfInt = IA;
  185. int i4 = paramInt2 + 1;
  186. int i5 = arrayOfInt[paramString.charAt(paramInt2)];
  187. arrayOfInt = IA;
  188. paramInt2 = i4 + 1;
  189. i3 = n << 18 | i3 << 12 | i5 << 6 | arrayOfInt[paramString.charAt(i4)];
  190. i4 = paramInt1 + 1;
  191. arrayOfByte[paramInt1] = ((byte)(i3 >> 16));
  192. n = i4 + 1;
  193. arrayOfByte[i4] = ((byte)(i3 >> 8));
  194. arrayOfByte[n] = ((byte)i3);
  195. paramInt1 = j;
  196. if (m <= 0)
  197. break label498;
  198. j += 1;
  199. paramInt1 = j;
  200. if (j != 19)
  201. break label498;
  202. paramInt1 = paramInt2 + 2;
  203. j = 0;
  204. }
  205. while (true)
  206. {
  207. n += 1;
  208. paramInt2 = paramInt1;
  209. paramInt1 = n;
  210. break label181;
  211. i = 1;
  212. break;
  213. i = 0;
  214. break;
  215. label383: paramInt2 = 0;
  216. break label139;
  217. label388: m = 0;
  218. break label144;
  219. label394: m = paramInt1;
  220. m = paramInt2;
  221. if (paramInt1 < i1)
  222. {
  223. j = 0;
  224. m = 0;
  225. while (paramInt2 <= k - i)
  226. {
  227. j |= IA[paramString.charAt(paramInt2)] << 18 - m * 6;
  228. m += 1;
  229. paramInt2 += 1;
  230. }
  231. i = 16;
  232. while (true)
  233. {
  234. m = paramInt1;
  235. m = paramInt2;
  236. if (paramInt1 >= i1)
  237. break;
  238. arrayOfByte[paramInt1] = ((byte)(j >> i));
  239. i -= 8;
  240. paramInt1 += 1;
  241. }
  242. }
  243. return arrayOfByte;
  244. label498: j = paramInt1;
  245. paramInt1 = paramInt2;
  246. }
  247. }
  248. public static final byte[] decodeFast(char[] paramArrayOfChar, int paramInt1, int paramInt2)
  249. {
  250. if (paramInt2 == 0)
  251. return new byte[0];
  252. int i = paramInt1;
  253. int j = paramInt1 + paramInt2 - 1;
  254. paramInt1 = i;
  255. int k;
  256. while (true)
  257. {
  258. k = j;
  259. if (paramInt1 >= j)
  260. break;
  261. k = j;
  262. if (IA[paramArrayOfChar[paramInt1]] >= 0)
  263. break;
  264. paramInt1 += 1;
  265. }
  266. while ((k > 0) && (IA[paramArrayOfChar[k]] < 0))
  267. k -= 1;
  268. label129: int m;
  269. label134: int i1;
  270. byte[] arrayOfByte;
  271. int n;
  272. if (paramArrayOfChar[k] == '=')
  273. if (paramArrayOfChar[(k - 1)] == '=')
  274. {
  275. i = 2;
  276. j = k - paramInt1 + 1;
  277. if (paramInt2 <= 76)
  278. break label370;
  279. if (paramArrayOfChar[76] != '\r')
  280. break label365;
  281. paramInt2 = j / 78;
  282. m = paramInt2 << 1;
  283. i1 = ((j - m) * 6 >> 3) - i;
  284. arrayOfByte = new byte[i1];
  285. j = 0;
  286. int i2 = i1 / 3;
  287. n = 0;
  288. paramInt2 = paramInt1;
  289. paramInt1 = n;
  290. label171: if (paramInt1 >= i2 * 3)
  291. break label376;
  292. int[] arrayOfInt = IA;
  293. int i3 = paramInt2 + 1;
  294. n = arrayOfInt[paramArrayOfChar[paramInt2]];
  295. arrayOfInt = IA;
  296. paramInt2 = i3 + 1;
  297. i3 = arrayOfInt[paramArrayOfChar[i3]];
  298. arrayOfInt = IA;
  299. int i4 = paramInt2 + 1;
  300. int i5 = arrayOfInt[paramArrayOfChar[paramInt2]];
  301. arrayOfInt = IA;
  302. paramInt2 = i4 + 1;
  303. i3 = n << 18 | i3 << 12 | i5 << 6 | arrayOfInt[paramArrayOfChar[i4]];
  304. i4 = paramInt1 + 1;
  305. arrayOfByte[paramInt1] = ((byte)(i3 >> 16));
  306. n = i4 + 1;
  307. arrayOfByte[i4] = ((byte)(i3 >> 8));
  308. arrayOfByte[n] = ((byte)i3);
  309. paramInt1 = j;
  310. if (m <= 0)
  311. break label478;
  312. j += 1;
  313. paramInt1 = j;
  314. if (j != 19)
  315. break label478;
  316. paramInt1 = paramInt2 + 2;
  317. j = 0;
  318. }
  319. while (true)
  320. {
  321. n += 1;
  322. paramInt2 = paramInt1;
  323. paramInt1 = n;
  324. break label171;
  325. i = 1;
  326. break;
  327. i = 0;
  328. break;
  329. label365: paramInt2 = 0;
  330. break label129;
  331. label370: m = 0;
  332. break label134;
  333. label376: m = paramInt1;
  334. m = paramInt2;
  335. if (paramInt1 < i1)
  336. {
  337. j = 0;
  338. m = 0;
  339. while (paramInt2 <= k - i)
  340. {
  341. j |= IA[paramArrayOfChar[paramInt2]] << 18 - m * 6;
  342. m += 1;
  343. paramInt2 += 1;
  344. }
  345. i = 16;
  346. while (true)
  347. {
  348. m = paramInt1;
  349. m = paramInt2;
  350. if (paramInt1 >= i1)
  351. break;
  352. arrayOfByte[paramInt1] = ((byte)(j >> i));
  353. i -= 8;
  354. paramInt1 += 1;
  355. }
  356. }
  357. return arrayOfByte;
  358. label478: j = paramInt1;
  359. paramInt1 = paramInt2;
  360. }
  361. }
  362. }
  363. /* Location: C:\Users\User\dex2jar-2.0\dex\qting\classes-dex2jar.jar
  364. * Qualified Name: com.alibaba.fastjson.util.Base64
  365. * JD-Core Version: 0.6.2
  366. */