(buffer, delimiter = '')
| 118 | |
| 119 | const hex = "0123456789ABCDEF"; |
| 120 | function toHexString(buffer, delimiter = '') { |
| 121 | const bytes = new Uint8Array(buffer); |
| 122 | const length = buffer.byteLength; |
| 123 | let result = new Array(length); |
| 124 | for (let index = 0; index < length; ++index) { |
| 125 | const byte = bytes[index]; |
| 126 | result[length - index - 1] = hex[byte >> 4] + hex[byte & 0x0F]; |
| 127 | } |
| 128 | return result.join(delimiter); |
| 129 | } |
| 130 | |
| 131 | export class Bytes extends ArrayBuffer { |
| 132 | constructor(bytes, littleEndian) { |