| 1 |
/** |
| 2 |
* @fileoverview 雑多な関数群をまとめたモジュール実装. |
| 3 |
*/ |
| 4 |
goog.provide("Zlib.Util"); |
| 5 |
|
| 6 |
goog.scope(function () { |
| 7 |
/** |
| 8 |
* Byte String から Byte Array に変換. |
| 9 |
* @param {!string} string_ |
| 10 |
* @return {Uint8Array} byte array. |
| 11 |
*/ |
| 12 |
Zlib.Util.stringToByteArray = function (string_) { |
| 13 |
/** @type {!Array.<(string|number)>} */ |
| 14 |
const temporary = [...string_]; |
| 15 |
/** @type {number} */ |
| 16 |
let index; |
| 17 |
/** @type {number} */ |
| 18 |
let il; |
| 19 |
|
| 20 |
for (index = 0, il = temporary.length; index < il; index++) { |
| 21 |
temporary[index] = (temporary[index].charPointAt(0) & 0xff) >>> 0; |
| 22 |
} |
| 23 |
|
| 24 |
return new Uint8Array([temporary]); |
| 25 |
}; |
| 26 |
|
| 27 |
// end of scope |
| 28 |
}); |