LLSDxmlEncode.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. // a class for low level LLSD encoding into a provided StringBuilder
  28. // for cases where we already need to know the low level detail
  29. // and so using something like OSD or even protbuf is just a pure waste
  30. using System;
  31. using System.Globalization;
  32. using System.Text;
  33. using OpenMetaverse;
  34. namespace OpenSim.Framework
  35. {
  36. public static class LLSDxmlEncode
  37. {
  38. static readonly DateTime depoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
  39. public static void AddStart(StringBuilder sb, bool addxmlversion = false)
  40. {
  41. if(addxmlversion)
  42. sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd>"); // legacy llsd xml name still valid
  43. else
  44. sb.Append("<llsd>");
  45. }
  46. public const string LLSDEmpty = "<llsd><map /></llsd>";
  47. // got tired of creating a stringbuilder all the time;
  48. public static StringBuilder Start(int size = 256, bool addxmlversion = false)
  49. {
  50. StringBuilder sb = new StringBuilder(size);
  51. if(addxmlversion)
  52. sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd>"); // legacy llsd xml name still valid
  53. else
  54. sb.Append("<llsd>");
  55. return sb;
  56. }
  57. public static void AddEnd(StringBuilder sb)
  58. {
  59. sb.Append("</llsd>");
  60. }
  61. public static string End(StringBuilder sb)
  62. {
  63. sb.Append("</llsd>");
  64. return sb.ToString();
  65. }
  66. // map == a list of key value pairs
  67. public static void AddMap(StringBuilder sb)
  68. {
  69. sb.Append("<map>");
  70. }
  71. public static void AddEndMap(StringBuilder sb)
  72. {
  73. sb.Append("</map>");
  74. }
  75. public static void AddEmptyMap(StringBuilder sb)
  76. {
  77. sb.Append("<map />");
  78. }
  79. // array == a list values
  80. public static void AddArray(StringBuilder sb)
  81. {
  82. sb.Append("<array>");
  83. }
  84. public static void AddEndArray(StringBuilder sb)
  85. {
  86. sb.Append("</array>");
  87. }
  88. public static void AddEndMapAndArray(StringBuilder sb)
  89. {
  90. sb.Append("</map></array>");
  91. }
  92. public static void AddEmptyArray(StringBuilder sb)
  93. {
  94. sb.Append("<array />");
  95. }
  96. // undefined or null
  97. public static void AddUnknownElem(StringBuilder sb)
  98. {
  99. sb.Append("<undef />");
  100. }
  101. public static void AddElem(bool e, StringBuilder sb)
  102. {
  103. if(e)
  104. sb.Append("<boolean>1</boolean>");
  105. else
  106. sb.Append("<boolean />");
  107. }
  108. public static void AddElem(byte e, StringBuilder sb)
  109. {
  110. if(e == 0)
  111. sb.Append("<integer />");
  112. else
  113. {
  114. sb.Append("<integer>");
  115. sb.Append(e.ToString());
  116. sb.Append("</integer>");
  117. }
  118. }
  119. public static void AddElem(byte[] e, StringBuilder sb)
  120. {
  121. if(e == null || e.Length == 0)
  122. sb.Append("binary />");
  123. else
  124. {
  125. sb.Append("<binary>"); // encode64 is default
  126. sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None));
  127. sb.Append("</binary>");
  128. }
  129. }
  130. public static void AddElem(int e, StringBuilder sb)
  131. {
  132. if(e == 0)
  133. sb.Append("<integer />");
  134. else
  135. {
  136. sb.Append("<integer>");
  137. sb.Append(e.ToString());
  138. sb.Append("</integer>");
  139. }
  140. }
  141. public static void AddElem(uint e, StringBuilder sb)
  142. {
  143. AddElem(uintToByteArray(e), sb);
  144. }
  145. public static void AddElem(ulong e, StringBuilder sb)
  146. {
  147. AddElem(ulongToByteArray(e), sb);
  148. }
  149. public static void AddElem(float e, StringBuilder sb)
  150. {
  151. if(e == 0)
  152. sb.Append("<real />");
  153. else
  154. {
  155. sb.Append("<real>");
  156. sb.Append(e.ToString(CultureInfo.InvariantCulture));
  157. sb.Append("</real>");
  158. }
  159. }
  160. public static void AddElem(Vector2 e, StringBuilder sb)
  161. {
  162. sb.Append("<array>");
  163. if(e.X == 0)
  164. sb.Append("<real />");
  165. else
  166. {
  167. sb.Append("<real>");
  168. sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
  169. sb.Append("</real>");
  170. }
  171. if(e.Y == 0)
  172. sb.Append("<real /></array>");
  173. else
  174. {
  175. sb.Append("<real>");
  176. sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
  177. sb.Append("</real></array>");
  178. }
  179. }
  180. public static void AddElem(Vector3 e, StringBuilder sb)
  181. {
  182. sb.Append("<array>");
  183. if(e.X == 0)
  184. sb.Append("<real />");
  185. else
  186. {
  187. sb.Append("<real>");
  188. sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
  189. sb.Append("</real>");
  190. }
  191. if(e.Y == 0)
  192. sb.Append("<real />");
  193. else
  194. {
  195. sb.Append("<real>");
  196. sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
  197. sb.Append("</real>");
  198. }
  199. if(e.Z == 0)
  200. sb.Append("<real /></array>");
  201. else
  202. {
  203. sb.Append("<real>");
  204. sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
  205. sb.Append("</real></array>");
  206. }
  207. }
  208. public static void AddElem(Quaternion e, StringBuilder sb)
  209. {
  210. sb.Append("<array><key>x</key>");
  211. if(e.X == 0)
  212. sb.Append("<real />");
  213. else
  214. {
  215. sb.Append("<real>");
  216. sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
  217. sb.Append("</real>");
  218. }
  219. if(e.Y == 0)
  220. sb.Append("<real />");
  221. else
  222. {
  223. sb.Append("<real>");
  224. sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
  225. sb.Append("</real>");
  226. }
  227. if(e.Z == 0)
  228. sb.Append("<real />");
  229. else
  230. {
  231. sb.Append("<real>");
  232. sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
  233. sb.Append("</real>");
  234. }
  235. if(e.W == 0)
  236. sb.Append("<real /></array>");
  237. else
  238. {
  239. sb.Append("<real>");
  240. sb.Append(e.W.ToString(CultureInfo.InvariantCulture));
  241. sb.Append("</real></array>");
  242. }
  243. }
  244. public static void AddElem(double e, StringBuilder sb)
  245. {
  246. if(e == 0)
  247. sb.Append("<real />");
  248. else
  249. {
  250. sb.Append("<real>");
  251. sb.Append(e.ToString(CultureInfo.InvariantCulture));
  252. sb.Append("</real>");
  253. }
  254. }
  255. public static void AddElem(UUID e, StringBuilder sb)
  256. {
  257. if(e == UUID.Zero)
  258. sb.Append("<uuid />");
  259. else
  260. {
  261. sb.Append("<uuid>");
  262. EscapeToXML(e.ToString(), sb);
  263. sb.Append("</uuid>");
  264. }
  265. }
  266. public static void AddElem(string e, StringBuilder sb)
  267. {
  268. if(String.IsNullOrEmpty(e))
  269. sb.Append("<string />");
  270. else
  271. {
  272. sb.Append("<string>");
  273. EscapeToXML(e, sb);
  274. sb.Append("</string>");
  275. }
  276. }
  277. public static void AddRawElem(string e, StringBuilder sb)
  278. {
  279. if(String.IsNullOrEmpty(e))
  280. sb.Append("<string />");
  281. else
  282. {
  283. sb.Append("<string>");
  284. sb.Append(e);
  285. sb.Append("</string>");
  286. }
  287. }
  288. public static void AddElem(Uri e, StringBuilder sb)
  289. {
  290. if(e == null)
  291. {
  292. sb.Append("<uri />");
  293. return;
  294. }
  295. string s;
  296. if (e.IsAbsoluteUri)
  297. s = e.AbsoluteUri;
  298. else
  299. s = e.ToString();
  300. if(String.IsNullOrEmpty(s))
  301. sb.Append("<uri />");
  302. else
  303. {
  304. sb.Append("<uri>");
  305. sb.Append(s);
  306. sb.Append("</uri>");
  307. }
  308. }
  309. public static void AddElem(DateTime e, StringBuilder sb)
  310. {
  311. DateTime u = e.ToUniversalTime();
  312. if(u == depoch)
  313. {
  314. sb.Append("<date />");
  315. return;
  316. }
  317. string format;
  318. if(u.Hour == 0 && u.Minute == 0 && u.Second == 0)
  319. format = "yyyy-MM-dd";
  320. else if (u.Millisecond > 0)
  321. format = "yyyy-MM-ddTHH:mm:ss.ffZ";
  322. else
  323. format = "yyyy-MM-ddTHH:mm:ssZ";
  324. sb.Append("<date>");
  325. sb.Append(u.ToString(format,CultureInfo.InvariantCulture));
  326. sb.Append("</date>");
  327. }
  328. //************ key value *******************
  329. // assumes name is a valid llsd key
  330. public static void AddMap(string name, StringBuilder sb)
  331. {
  332. sb.Append("<key>");
  333. sb.Append(name);
  334. sb.Append("</key><map>");
  335. }
  336. public static void AddEmptyMap(string name, StringBuilder sb)
  337. {
  338. sb.Append("<key>");
  339. sb.Append(name);
  340. sb.Append("</key><map />");
  341. }
  342. // array == a list values
  343. public static void AddArray(string name, StringBuilder sb)
  344. {
  345. sb.Append("<key>");
  346. sb.Append(name);
  347. sb.Append("</key><array>");
  348. }
  349. public static void AddArrayAndMap(string name, StringBuilder sb)
  350. {
  351. sb.Append("<key>");
  352. sb.Append(name);
  353. sb.Append("</key><array><map>");
  354. }
  355. public static void AddEmptyArray(string name, StringBuilder sb)
  356. {
  357. sb.Append("<key>");
  358. sb.Append(name);
  359. sb.Append("</key><array />");
  360. }
  361. // undefined or null
  362. public static void AddUnknownElem(string name, StringBuilder sb)
  363. {
  364. sb.Append("<key>");
  365. sb.Append(name);
  366. sb.Append("</key><undef />");
  367. }
  368. public static void AddElem(string name, bool e, StringBuilder sb)
  369. {
  370. sb.Append("<key>");
  371. sb.Append(name);
  372. sb.Append("</key>");
  373. if(e)
  374. sb.Append("<boolean>1</boolean>");
  375. else
  376. sb.Append("<boolean />");
  377. }
  378. public static void AddElem(string name, byte e, StringBuilder sb)
  379. {
  380. sb.Append("<key>");
  381. sb.Append(name);
  382. sb.Append("</key>");
  383. if(e == 0)
  384. sb.Append("<integer />");
  385. else
  386. {
  387. sb.Append("<integer>");
  388. sb.Append(e.ToString());
  389. sb.Append("</integer>");
  390. }
  391. }
  392. public static void AddElem(string name, byte[] e, StringBuilder sb)
  393. {
  394. sb.Append("<key>");
  395. sb.Append(name);
  396. sb.Append("</key>");
  397. if(e == null || e.Length == 0)
  398. sb.Append("binary />");
  399. else
  400. {
  401. sb.Append("<binary>"); // encode64 is default
  402. sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None));
  403. sb.Append("</binary>");
  404. }
  405. }
  406. public static void AddElem(string name, int e, StringBuilder sb)
  407. {
  408. sb.Append("<key>");
  409. sb.Append(name);
  410. sb.Append("</key>");
  411. if(e == 0)
  412. sb.Append("<integer />");
  413. else
  414. {
  415. sb.Append("<integer>");
  416. sb.Append(e.ToString());
  417. sb.Append("</integer>");
  418. }
  419. }
  420. public static void AddElem(string name, uint e, StringBuilder sb)
  421. {
  422. AddElem(name, uintToByteArray(e), sb);
  423. }
  424. public static void AddElem(string name, ulong e, StringBuilder sb)
  425. {
  426. AddElem(name, ulongToByteArray(e), sb);
  427. }
  428. public static void AddElem(string name, float e, StringBuilder sb)
  429. {
  430. sb.Append("<key>");
  431. sb.Append(name);
  432. sb.Append("</key>");
  433. if(e == 0)
  434. sb.Append("<real />");
  435. else
  436. {
  437. sb.Append("<real>");
  438. sb.Append(e.ToString(CultureInfo.InvariantCulture));
  439. sb.Append("</real>");
  440. }
  441. }
  442. public static void AddElem(string name, Vector2 e, StringBuilder sb)
  443. {
  444. sb.Append("<key>");
  445. sb.Append(name);
  446. sb.Append("</key><array>>");
  447. if(e.X == 0)
  448. sb.Append("<real />");
  449. else
  450. {
  451. sb.Append("<real>");
  452. sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
  453. sb.Append("</real>");
  454. }
  455. if(e.Y == 0)
  456. sb.Append("<real /></array>");
  457. else
  458. {
  459. sb.Append("<real>");
  460. sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
  461. sb.Append("</real></array>");
  462. }
  463. }
  464. public static void AddElem(string name, Vector3 e, StringBuilder sb)
  465. {
  466. sb.Append("<key>");
  467. sb.Append(name);
  468. sb.Append("</key><array>");
  469. if(e.X == 0)
  470. sb.Append("<real />");
  471. else
  472. {
  473. sb.Append("<real>");
  474. sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
  475. sb.Append("</real>");
  476. }
  477. if(e.Y == 0)
  478. sb.Append("<real />");
  479. else
  480. {
  481. sb.Append("<real>");
  482. sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
  483. sb.Append("</real>");
  484. }
  485. if(e.Z == 0)
  486. sb.Append("<real /></array>");
  487. else
  488. {
  489. sb.Append("<real>");
  490. sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
  491. sb.Append("</real></array>");
  492. }
  493. }
  494. public static void AddElem(string name, Quaternion e, StringBuilder sb)
  495. {
  496. sb.Append("<key>");
  497. sb.Append(name);
  498. sb.Append("</key><array>");
  499. if(e.X == 0)
  500. sb.Append("<real />");
  501. else
  502. {
  503. sb.Append("<real>");
  504. sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
  505. sb.Append("</real>");
  506. }
  507. if(e.Y == 0)
  508. sb.Append("<real />");
  509. else
  510. {
  511. sb.Append("<real>");
  512. sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
  513. sb.Append("</real>");
  514. }
  515. if(e.Z == 0)
  516. sb.Append("<real />");
  517. else
  518. {
  519. sb.Append("<real>");
  520. sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
  521. sb.Append("</real>");
  522. }
  523. if(e.W == 0)
  524. sb.Append("<real /></array>");
  525. else
  526. {
  527. sb.Append("<real>");
  528. sb.Append(e.W.ToString(CultureInfo.InvariantCulture));
  529. sb.Append("</real></array>");
  530. }
  531. }
  532. public static void AddElem(string name, double e, StringBuilder sb)
  533. {
  534. sb.Append("<key>");
  535. sb.Append(name);
  536. sb.Append("</key>");
  537. if(e == 0)
  538. sb.Append("<real />");
  539. else
  540. {
  541. sb.Append("<real>");
  542. sb.Append(e.ToString(CultureInfo.InvariantCulture));
  543. sb.Append("</real>");
  544. }
  545. }
  546. public static void AddElem(string name, UUID e, StringBuilder sb)
  547. {
  548. sb.Append("<key>");
  549. sb.Append(name);
  550. sb.Append("</key>");
  551. if(e == UUID.Zero)
  552. sb.Append("<uuid />");
  553. else
  554. {
  555. sb.Append("<uuid>");
  556. EscapeToXML(e.ToString(), sb);
  557. sb.Append("</uuid>");
  558. }
  559. }
  560. public static void AddElem(string name, string e, StringBuilder sb)
  561. {
  562. sb.Append("<key>");
  563. sb.Append(name);
  564. sb.Append("</key>");
  565. if(String.IsNullOrEmpty(e))
  566. sb.Append("<string />");
  567. else
  568. {
  569. sb.Append("<string>");
  570. EscapeToXML(e, sb);
  571. sb.Append("</string>");
  572. }
  573. }
  574. public static void AddRawElem(string name, string e, StringBuilder sb)
  575. {
  576. sb.Append("<key>");
  577. sb.Append(name);
  578. sb.Append("</key>");
  579. if(String.IsNullOrEmpty(e))
  580. sb.Append("<string />");
  581. else
  582. {
  583. sb.Append("<string>");
  584. sb.Append(e);
  585. sb.Append("</string>");
  586. }
  587. }
  588. public static void AddElem(string name, Uri e, StringBuilder sb)
  589. {
  590. sb.Append("<key>");
  591. sb.Append(name);
  592. sb.Append("</key>");
  593. if(e == null)
  594. {
  595. sb.Append("<uri />");
  596. return;
  597. }
  598. string s;
  599. if (e.IsAbsoluteUri)
  600. s = e.AbsoluteUri;
  601. else
  602. s = e.ToString();
  603. if(String.IsNullOrEmpty(s))
  604. sb.Append("<uri />");
  605. else
  606. {
  607. sb.Append("<uri>");
  608. sb.Append(s);
  609. sb.Append("</uri>");
  610. }
  611. }
  612. public static void AddElem(string name, DateTime e, StringBuilder sb)
  613. {
  614. sb.Append("<key>");
  615. sb.Append(name);
  616. sb.Append("</key>");
  617. DateTime u = e.ToUniversalTime();
  618. if(u == depoch)
  619. {
  620. sb.Append("<date />");
  621. return;
  622. }
  623. string format;
  624. if(u.Hour == 0 && u.Minute == 0 && u.Second == 0)
  625. format = "yyyy-MM-dd";
  626. else if (u.Millisecond > 0)
  627. format = "yyyy-MM-ddTHH:mm:ss.ffZ";
  628. else
  629. format = "yyyy-MM-ddTHH:mm:ssZ";
  630. sb.Append("<date>");
  631. sb.Append(u.ToString(format,CultureInfo.InvariantCulture));
  632. sb.Append("</date>");
  633. }
  634. public static void AddLLSD(string e, StringBuilder sb)
  635. {
  636. sb.Append(e);
  637. }
  638. public static void EscapeToXML(string s, StringBuilder sb)
  639. {
  640. int i;
  641. char c;
  642. int len = s.Length;
  643. for (i = 0; i < len; i++)
  644. {
  645. c = s[i];
  646. switch (c)
  647. {
  648. case '<':
  649. sb.Append("&lt;");
  650. break;
  651. case '>':
  652. sb.Append("&gt;");
  653. break;
  654. case '&':
  655. sb.Append("&amp;");
  656. break;
  657. case '"':
  658. sb.Append("&quot;");
  659. break;
  660. case '\\':
  661. sb.Append("&apos;");
  662. break;
  663. default:
  664. sb.Append(c);
  665. break;
  666. }
  667. }
  668. }
  669. public static byte[] ulongToByteArray(ulong uLongValue)
  670. {
  671. return new byte[8]
  672. {
  673. (byte)(uLongValue >> 56),
  674. (byte)(uLongValue >> 48),
  675. (byte)(uLongValue >> 40),
  676. (byte)(uLongValue >> 32),
  677. (byte)(uLongValue >> 24),
  678. (byte)(uLongValue >> 16),
  679. (byte)(uLongValue >> 8),
  680. (byte)uLongValue
  681. };
  682. }
  683. public static byte[] uintToByteArray(uint value)
  684. {
  685. return new byte[4]
  686. {
  687. (byte)(value >> 24),
  688. (byte)(value >> 16),
  689. (byte)(value >> 8),
  690. (byte)value
  691. };
  692. }
  693. }
  694. }