bytebuffer.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862
  1. /*
  2. * Copyright 2012 The Closure Compiler Authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * @fileoverview Externs for ByteBuffer.js.
  18. * @see https://github.com/dcodeIO/ByteBuffer.js
  19. * @externs
  20. */
  21. /**
  22. BEGIN_NODE_INCLUDE
  23. var ByteBuffer = require('bytebuffer');
  24. END_NODE_INCLUDE
  25. */
  26. /**
  27. * @param {number=} capacity
  28. * @param {boolean=} littleEndian
  29. * @param {boolean=} sparse
  30. * @constructor
  31. */
  32. function ByteBuffer(capacity, littleEndian, sparse) {};
  33. /**
  34. * @type {?ArrayBuffer}
  35. */
  36. ByteBuffer.prototype.array;
  37. /**
  38. * @type {number}
  39. */
  40. ByteBuffer.prototype.offset;
  41. /**
  42. * @type {number}
  43. */
  44. ByteBuffer.prototype.markedOffset;
  45. /**
  46. * @type {number}
  47. */
  48. ByteBuffer.prototype.limit;
  49. /**
  50. * @type {boolean}
  51. */
  52. ByteBuffer.prototype.littleEndian;
  53. /**
  54. * @type {string}
  55. * @const
  56. */
  57. ByteBuffer.VERSION;
  58. /**
  59. * @type {number}
  60. * @const
  61. */
  62. ByteBuffer.DEFAULT_CAPACITY = 32;
  63. /**
  64. * @type {boolean}
  65. * @const
  66. */
  67. ByteBuffer.LITTLE_ENDIAN = true;
  68. /**
  69. * @type {boolean}
  70. * @const
  71. */
  72. ByteBuffer.BIG_ENDIAN = false;
  73. /**
  74. * @param {number=} capacity
  75. * @param {boolean=} littleEndian
  76. * @returns {!ByteBuffer}
  77. * @nosideeffects
  78. */
  79. ByteBuffer.allocate = function(capacity, littleEndian) {};
  80. /**
  81. * @param {!ArrayBuffer|!Buffer|!{array: ArrayBuffer}|!{buffer: ArrayBuffer}|string} buffer
  82. * @param {(string|boolean)=} enc
  83. * @param {boolean=} littleEndian
  84. * @returns {!ByteBuffer}
  85. * @throws {Error}
  86. * @nosideeffects
  87. */
  88. ByteBuffer.wrap = function(buffer, enc, littleEndian) {};
  89. /**
  90. * @param {boolean=} littleEndian
  91. * @returns {!ByteBuffer}
  92. */
  93. ByteBuffer.prototype.LE = function(littleEndian) {};
  94. /**
  95. * @param {boolean=} bigEndian
  96. * @returns {!ByteBuffer}
  97. */
  98. ByteBuffer.prototype.BE = function(bigEndian) {};
  99. /**
  100. * @param {string} str
  101. * @param {boolean} littleEndian
  102. * @param {boolean} noAssert
  103. * @returns {!ByteBuffer}
  104. */
  105. ByteBuffer.prototype.fromBase64 = function(str, littleEndian, noAssert) {};
  106. /**
  107. * @param {string} str
  108. * @param {boolean} littleEndian
  109. * @param {boolean} noAssert
  110. * @returns {!ByteBuffer}
  111. */
  112. ByteBuffer.prototype.fromBinary = function(str, littleEndian, noAssert) {};
  113. /**
  114. * @param {string} str
  115. * @param {boolean} littleEndian
  116. * @param {boolean} noAssert
  117. * @returns {!ByteBuffer}
  118. */
  119. ByteBuffer.prototype.fromDebug = function(str, littleEndian, noAssert) {};
  120. /**
  121. * @param {string} str
  122. * @param {boolean} littleEndian
  123. * @param {boolean} noAssert
  124. * @returns {!ByteBuffer}
  125. */
  126. ByteBuffer.prototype.fromHex = function(str, littleEndian, noAssert) {};
  127. /**
  128. * @param {string} str
  129. * @param {boolean} littleEndian
  130. * @param {boolean} noAssert
  131. * @returns {!ByteBuffer}
  132. */
  133. ByteBuffer.prototype.fromUTF8 = function(str, littleEndian, noAssert) {};
  134. /**
  135. * @param {number} capacity
  136. * @returns {boolean}
  137. */
  138. ByteBuffer.prototype.resize = function(capacity) {};
  139. /**
  140. * @param {number} begin
  141. * @param {number} end
  142. * @returns {!ByteBuffer}
  143. * @throws {Error}
  144. * @nosideeffects
  145. */
  146. ByteBuffer.prototype.slice = function(begin, end) {};
  147. /**
  148. * @param {number} begin
  149. * @param {number} end
  150. * @returns {!ByteBuffer}
  151. * @throws {Error}
  152. * @nosideeffects
  153. */
  154. ByteBuffer.prototype.sliceAndCompact = function(begin, end) {};
  155. /**
  156. * @param {number} capacity
  157. * @returns {boolean}
  158. */
  159. ByteBuffer.prototype.ensureCapacity = function(capacity) {};
  160. /**
  161. * @returns {!ByteBuffer}
  162. */
  163. ByteBuffer.prototype.flip = function() {};
  164. /**
  165. * @param {number=} offset
  166. * @returns {!ByteBuffer}
  167. * @throws {Error}
  168. */
  169. ByteBuffer.prototype.mark = function(offset) {};
  170. /**
  171. * @returns {!ByteBuffer} this
  172. */
  173. ByteBuffer.prototype.reset = function() {};
  174. /**
  175. * @returns {!ByteBuffer}
  176. * @nosideeffects
  177. */
  178. ByteBuffer.prototype.clone = function() {};
  179. /**
  180. * @returns {!ByteBuffer}
  181. * @nosideeffects
  182. */
  183. ByteBuffer.prototype.copy = function() {};
  184. /**
  185. * @returns {number}
  186. * @nosideeffects
  187. */
  188. ByteBuffer.prototype.remaining = function() {};
  189. /**
  190. * @returns {number}
  191. * @nosideeffects
  192. */
  193. ByteBuffer.prototype.capacity = function() {};
  194. /**
  195. * @returns {!ByteBuffer}
  196. * @throws {Error}
  197. */
  198. ByteBuffer.prototype.compact = function() {};
  199. /**
  200. * @returns {!ByteBuffer}
  201. * @throws {Error}
  202. */
  203. ByteBuffer.prototype.reverse = function() {};
  204. /**
  205. * @param {!ByteBuffer} src
  206. * @param {number=} offset
  207. * @returns {!ByteBuffer}
  208. * @throws {Error}
  209. */
  210. ByteBuffer.prototype.append = function(src, offset) {};
  211. /**
  212. * @param {!ByteBuffer} src
  213. * @param {number=} offset
  214. * @returns {!ByteBuffer}
  215. * @throws {Error}
  216. */
  217. ByteBuffer.prototype.prepend = function(src, offset) {};
  218. /**
  219. * @param {number|string} value
  220. * @param {number} begin
  221. * @param {number} end
  222. * @returns {!ByteBuffer}
  223. */
  224. ByteBuffer.prototype.fill = function(value, begin, end) {};
  225. /**
  226. * @param {number} value
  227. * @param {number=} offset
  228. * @returns {!ByteBuffer}
  229. */
  230. ByteBuffer.prototype.writeInt8 = function(value, offset) {};
  231. /**
  232. * @param {number=} offset
  233. * @returns {number}
  234. * @throws {Error}
  235. */
  236. ByteBuffer.prototype.readInt8 = function(offset) {};
  237. /**
  238. * @param {number} value
  239. * @param {number=} offset
  240. * @returns {!ByteBuffer}
  241. */
  242. ByteBuffer.prototype.writeByte = function(value, offset) {};
  243. /**
  244. * @param {number=} offset
  245. * @returns {number}
  246. * @throws {Error}
  247. */
  248. ByteBuffer.prototype.readByte = function(offset) {};
  249. /**
  250. * @param {number} value
  251. * @param {number=} offset
  252. * @returns {!ByteBuffer}
  253. */
  254. ByteBuffer.prototype.writeUint8 = function(value, offset) {};
  255. /**
  256. * @param {number=} offset
  257. * @returns {number}
  258. * @throws {Error}
  259. */
  260. ByteBuffer.prototype.readUint8 = function(offset) {};
  261. /**
  262. * @param {number} value
  263. * @param {number=} offset
  264. * @returns {!ByteBuffer}
  265. */
  266. ByteBuffer.prototype.writeInt16 = function(value, offset) {};
  267. /**
  268. * @param {number=} offset
  269. * @returns {number}
  270. * @throws {Error}
  271. */
  272. ByteBuffer.prototype.readInt16 = function(offset) {};
  273. /**
  274. * @param {number} value
  275. * @param {number=} offset
  276. * @returns {!ByteBuffer}
  277. */
  278. ByteBuffer.prototype.writeShort = function(value, offset) {};
  279. /**
  280. * @param {number=} offset
  281. * @returns {number}
  282. * @throws {Error}
  283. */
  284. ByteBuffer.prototype.readShort = function (offset) {};
  285. /**
  286. * @param {number} value
  287. * @param {number=} offset
  288. * @returns {!ByteBuffer}
  289. */
  290. ByteBuffer.prototype.writeUint16 = function(value, offset) {};
  291. /**
  292. * @param {number=} offset
  293. * @returns {number}
  294. * @throws {Error}
  295. */
  296. ByteBuffer.prototype.readUint16 = function(offset) {};
  297. /**
  298. * @param {number} value
  299. * @param {number=} offset
  300. * @returns {!ByteBuffer}
  301. */
  302. ByteBuffer.prototype.writeInt32 = function(value, offset) {};
  303. /**
  304. * @param {number=} offset
  305. * @returns {number}
  306. * @throws {Error}
  307. */
  308. ByteBuffer.prototype.readInt32 = function(offset) {};
  309. /**
  310. * @param {number} value
  311. * @param {number=} offset
  312. * @returns {!ByteBuffer}
  313. */
  314. ByteBuffer.prototype.writeInt = function(value, offset) {};
  315. /**
  316. * @param {number=} offset
  317. * @returns {number}
  318. * @throws {Error}
  319. */
  320. ByteBuffer.prototype.readInt = function(offset) {};
  321. /**
  322. * @param {number} value
  323. * @param {number=} offset
  324. * @returns {!ByteBuffer}
  325. */
  326. ByteBuffer.prototype.writeUint32 = function(value, offset) {};
  327. /**
  328. * @param {number=} offset
  329. * @returns {number}
  330. * @throws {Error}
  331. */
  332. ByteBuffer.prototype.readUint32 = function(offset) {};
  333. /**
  334. * @param {number|Long} value
  335. * @param {number=} offset
  336. * @returns {!ByteBuffer}
  337. */
  338. ByteBuffer.prototype.writeInt64 = function(value, offset) {};
  339. /**
  340. * @param {number=} offset
  341. * @returns {Long}
  342. * @throws {Error}
  343. */
  344. ByteBuffer.prototype.readInt64 = function(offset) {};
  345. /**
  346. * @param {number|Long} value
  347. * @param {number=} offset
  348. * @returns {!ByteBuffer}
  349. */
  350. ByteBuffer.prototype.writeUint64 = function(value, offset) {};
  351. /**
  352. * @param {number=} offset
  353. * @returns {Long}
  354. * @throws {Error}
  355. */
  356. ByteBuffer.prototype.readUint64 = function(offset) {};
  357. /**
  358. * @param {number} value
  359. * @param {number=} offset
  360. * @returns {!ByteBuffer}
  361. */
  362. ByteBuffer.prototype.writeFloat32 = function(value, offset) {};
  363. /**
  364. * @param {number=} offset
  365. * @returns {number}
  366. * @throws {Error}
  367. */
  368. ByteBuffer.prototype.readFloat32 = function(offset) {};
  369. /**
  370. * @param {number} value
  371. * @param {number=} offset
  372. * @returns {!ByteBuffer}
  373. */
  374. ByteBuffer.prototype.writeFloat = function(value, offset) {};
  375. /**
  376. * @param {number=} offset
  377. * @returns {number}
  378. * @throws {Error}
  379. */
  380. ByteBuffer.prototype.readFloat = function(offset) {};
  381. /**
  382. * @param {number} value
  383. * @param {number=} offset
  384. * @returns {!ByteBuffer}
  385. */
  386. ByteBuffer.prototype.writeFloat64 = function(value, offset) {};
  387. /**
  388. * @param {number=} offset
  389. * @returns {number}
  390. * @throws {Error}
  391. */
  392. ByteBuffer.prototype.readFloat64 = function(offset) {};
  393. /**
  394. * @param {number} value
  395. * @param {number=} offset
  396. * @returns {!ByteBuffer}
  397. */
  398. ByteBuffer.prototype.writeDouble = function(value, offset) {};
  399. /**
  400. * @param {number=} offset
  401. * @returns {number}
  402. * @throws {Error}
  403. */
  404. ByteBuffer.prototype.readDouble = function(offset) {};
  405. /**
  406. * @param {number} value
  407. * @param {number=} offset
  408. * @returns {!ByteBuffer}
  409. */
  410. ByteBuffer.prototype.writeLong = function(value, offset) {};
  411. /**
  412. * @param {number=} offset
  413. * @returns {number}
  414. * @throws {Error}
  415. */
  416. ByteBuffer.prototype.readLong = function(offset) {};
  417. /**
  418. * @param {number} value
  419. * @param {number=} offset
  420. * @returns {!ByteBuffer|number}
  421. */
  422. ByteBuffer.prototype.writeVarint32 = function(value, offset) {};
  423. /**
  424. * @param {number=} offset
  425. * @returns {number|!{value: number, length: number}}
  426. * @throws {Error}
  427. */
  428. ByteBuffer.prototype.readVarint32 = function(offset) {};
  429. /**
  430. * @param {number} value
  431. * @param {number=} offset
  432. * @returns {!ByteBuffer|number}
  433. */
  434. ByteBuffer.prototype.writeZigZagVarint32 = function(value, offset) {};
  435. /**
  436. * @param {number=} offset
  437. * @returns {number|{value: number, length: number}}
  438. * @throws {Error}
  439. */
  440. ByteBuffer.prototype.readZigZagVarint32 = function(offset) {};
  441. /**
  442. * @param {number|Long} value
  443. * @param {number=} offset
  444. * @returns {!ByteBuffer|number}
  445. * @throws {Error}
  446. */
  447. ByteBuffer.prototype.writeVarint64 = function(value, offset) {};
  448. /**
  449. * @param {number=} offset
  450. * @returns {!Long|{value: !Long, length: number}}
  451. * @throws {Error}
  452. */
  453. ByteBuffer.prototype.readVarint64 = function(offset) {};
  454. /**
  455. * @param {number|Long} value
  456. * @param {number=} offset
  457. * @returns {!ByteBuffer|number}
  458. * @throws {Error}
  459. */
  460. ByteBuffer.prototype.writeZigZagVarint64 = function(value, offset) {};
  461. /**
  462. * @param {number=} offset
  463. * @returns {!Long|!{value: !Long, length: number}}
  464. * @throws {Error}
  465. */
  466. ByteBuffer.prototype.readZigZagVarint64 = function(offset) {};
  467. /**
  468. * @param {number|Long} value
  469. * @param {number=} offset
  470. * @returns {!ByteBuffer|number}
  471. * @throws {Error}
  472. */
  473. ByteBuffer.prototype.writeVarint64ZigZag = function(value, offset) {};
  474. /**
  475. * @param {number=} offset
  476. * @returns {!Long|{value: !Long, length: number}}
  477. * @throws {Error}
  478. */
  479. ByteBuffer.prototype.readVarint64ZigZag = function(offset) {};
  480. /**
  481. * @param {number} value
  482. * @param {number=} offset
  483. * @returns {!ByteBuffer|number}
  484. */
  485. ByteBuffer.prototype.writeVarint = function(value, offset) {};
  486. /**
  487. * @param {number=} offset
  488. * @returns {number|!{value: number, length: number}}
  489. * @throws {Error}
  490. */
  491. ByteBuffer.prototype.readVarint = function(offset) {};
  492. /**
  493. * @param {number} value
  494. * @param {number=} offset
  495. * @returns {!ByteBuffer|number}
  496. */
  497. ByteBuffer.prototype.writeZigZagVarint = function(value, offset) {};
  498. /**
  499. * @param {number=} offset
  500. * @returns {number|{value: number, length: number}}
  501. * @throws {Error}
  502. */
  503. ByteBuffer.prototype.readZigZagVarint = function(offset) {};
  504. /**
  505. * @param {number} value
  506. * @returns {number}
  507. * @throws {Error}
  508. * @nosideeffects
  509. */
  510. ByteBuffer.calculateVarint32 = function(value) {};
  511. /**
  512. * @param {number} value
  513. * @returns {number}
  514. * @throws {Error}
  515. * @nosideeffects
  516. */
  517. ByteBuffer.calculateVarint64 = function(value) {};
  518. /**
  519. * @param {string} str
  520. * @returns {number}
  521. * @nosideeffects
  522. */
  523. ByteBuffer.calculateUTF8String = function(str) {};
  524. /**
  525. * @param {string} str
  526. * @returns {number}
  527. */
  528. ByteBuffer.prototype.calculateUTF8Bytes = function(str) {};
  529. /**
  530. * @param {string} str
  531. * @param {number=} offset
  532. * @returns {!ByteBuffer|number}
  533. */
  534. ByteBuffer.prototype.writeUTF8String = function(str, offset) {};
  535. /**
  536. * @param {number} chars
  537. * @param {number=} offset
  538. * @returns {string|!{string: string, length: number}}
  539. * @throws {Error}
  540. */
  541. ByteBuffer.prototype.readUTF8String = function(chars, offset) {};
  542. /**
  543. * @param {number} length
  544. * @param {number} offset
  545. * @throws {Error}
  546. */
  547. ByteBuffer.prototype.readUTF8StringBytes = function(length, offset) {};
  548. /**
  549. * @param {string} str
  550. * @param {number=} offset
  551. * @returns {!ByteBuffer|number}
  552. */
  553. ByteBuffer.prototype.writeLString = function(str, offset) {};
  554. /**
  555. * @param {number=} offset
  556. * @returns {string|!{string: string, length: number}}
  557. * @throws {Error}
  558. */
  559. ByteBuffer.prototype.readLString = function(offset) {};
  560. /**
  561. * @param {string} str
  562. * @param {number=} offset
  563. * @returns {!ByteBuffer|number}
  564. */
  565. ByteBuffer.prototype.writeVString = function(str, offset) {};
  566. /**
  567. * @param {number=} offset
  568. * @returns {string|!{string: string, length: number}}
  569. * @throws {Error}
  570. */
  571. ByteBuffer.prototype.readVString = function(offset) {};
  572. /**
  573. * @param {string} str
  574. * @param {number=} offset
  575. * @returns {!ByteBuffer|number}
  576. */
  577. ByteBuffer.prototype.writeCString = function(str, offset) {};
  578. /**
  579. * @param {number=} offset
  580. * @returns {string|!{string: string, length: number}}
  581. * @throws {Error}
  582. */
  583. ByteBuffer.prototype.readCString = function(offset) {};
  584. /**
  585. * @param {number} length
  586. * @param {number=} offset
  587. * @returns {!ByteBuffer}
  588. */
  589. ByteBuffer.prototype.readBytes = function(length, offset) {};
  590. /**
  591. * @param {!ByteBuffer} src
  592. * @param {number=} offset
  593. * @returns {!ByteBuffer}
  594. * @throws {Error}
  595. */
  596. ByteBuffer.prototype.writeBytes = function(src, offset) {};
  597. /**
  598. * @param {number=} offset
  599. * @returns {Array<boolean>}
  600. */
  601. ByteBufferPrototype.readBitSet = function(offset) {};
  602. /**
  603. * @param {Array<boolean>}
  604. * @param {number=}
  605. * @returns {!ByteBuffer}
  606. */
  607. ByteBuffer.prototype.writeBitSet = function(value, offset) {};
  608. /**
  609. * @param {number=} wrap
  610. * @returns {string}
  611. * @nosideeffects
  612. */
  613. ByteBuffer.prototype.toColumns = function(wrap) {};
  614. /**
  615. * @param {function(string)=} out
  616. */
  617. ByteBuffer.prototype.printDebug = function(out) {};
  618. /**
  619. * @param {boolean=} debug
  620. * @returns {string}
  621. * @nosideeffects
  622. */
  623. ByteBuffer.prototype.toHex = function(debug) {};
  624. /**
  625. * @returns {string}
  626. * @nosideeffects
  627. */
  628. ByteBuffer.prototype.toBinary = function() {};
  629. /**
  630. * @returns {string}
  631. * @nosideeffects
  632. */
  633. ByteBuffer.prototype.toUTF8 = function() {};
  634. /**
  635. * @returns {string}
  636. * @nosideeffects
  637. */
  638. ByteBuffer.prototype.toBase64 = function() {};
  639. /**
  640. * @param {string=} enc
  641. * @returns {string}
  642. * @nosideeffects
  643. */
  644. ByteBuffer.prototype.toString = function(enc) {};
  645. /**
  646. * @param {boolean=} forceCopy
  647. * @returns {ArrayBuffer}
  648. * @nosideeffects
  649. */
  650. ByteBuffer.prototype.toArrayBuffer = function(forceCopy) {};
  651. /**
  652. * @param {!ByteBuffer} src
  653. * @param {number} offset
  654. * @returns {!{char: number, length: number}}
  655. * @nosideeffects
  656. */
  657. ByteBuffer.decodeUTF8Char = function(src, offset) {};
  658. /**
  659. * @param {number} charCode
  660. * @param {!ByteBuffer} dst
  661. * @param {number} offset
  662. * @returns {number}
  663. * @throws {Error}
  664. */
  665. ByteBuffer.encodeUTF8Char = function(charCode, dst, offset) {};
  666. /**
  667. * @param {number} charCode
  668. * @returns {number}
  669. * @throws {Error}
  670. * @nosideeffects
  671. */
  672. ByteBuffer.calculateUTF8Char = function(charCode) {};
  673. /**
  674. * @param {number} n
  675. * @returns {number}
  676. * @nosideeffects
  677. */
  678. ByteBuffer.zigZagEncode32 = function(n) {};
  679. /**
  680. * @param {number} n
  681. * @returns {number}
  682. * @nosideeffects
  683. */
  684. ByteBuffer.zigZagDecode32 = function(n) {};
  685. /**
  686. * @param {!ByteBuffer} bb
  687. * @returns {string}
  688. * @throws {Error}
  689. * @nosideeffects
  690. */
  691. ByteBuffer.encode64 = function(bb) {};
  692. /**
  693. * @param {string} str
  694. * @param {boolean=} littleEndian
  695. * @returns {!ByteBuffer}
  696. * @throws {Error}
  697. * @nosideeffects
  698. */
  699. ByteBuffer.decode64 = function(str, littleEndian) {};
  700. /**
  701. * @param {!ByteBuffer} bb
  702. * @returns {string}
  703. * @throws {Error}
  704. * @nosideeffects
  705. */
  706. ByteBuffer.encodeHex = function(bb) {};
  707. /**
  708. * @param {string} str
  709. * @param {boolean=} littleEndian
  710. * @returns {!ByteBuffer}
  711. * @throws {Error}
  712. * @nosideeffects
  713. */
  714. ByteBuffer.decodeHex = function(str, littleEndian) {};
  715. /**
  716. * @param {!ByteBuffer} bb
  717. * @returns {string}
  718. * @throws {Error}
  719. * @nosideeffects
  720. */
  721. ByteBuffer.encodeBinary = function(bb) {};
  722. /**
  723. * @param {string} str
  724. * @param {boolean=} littleEndian
  725. * @returns {!ByteBuffer}
  726. * @throws {Error}
  727. * @nosideeffects
  728. */
  729. ByteBuffer.decodeBinary = function(str, littleEndian) {};
  730. /**
  731. * @type {number}
  732. * @const
  733. */
  734. ByteBuffer.MAX_VARINT32_BYTES = 5;
  735. /**
  736. * @type {number}
  737. * @const
  738. */
  739. ByteBuffer.MAX_VARINT64_BYTES = 10;