步骤二，Unicode码转字符串 ArrayBuffer对象 Unicode码转字符串
171295
function getStringFromCharCode(dataView, start, length) {
  var str = '';
  var i;
  for (i = start, length += start; i < length; i++) {
    str += String.fromCharCode(dataView.getUint8(i));
  }
  return str;
}
43254
private CharBuffer filter(char []array)
  {
    CharBuffer buf = new CharBuffer();
    CharBuffer fun = new CharBuffer();
    CharBuffer file = new CharBuffer();

    int i = 0;
    while (i < array.length) {
      fun.clear();
      file.clear();
      int start = i;
      int end;
      for (end = i; end < array.length && array[end] != '\n'; end++) {
      }

      for (; i < end && Character.isWhitespace(array[i]); i++) {
        fun.append(array[i]);
      }

      // skip 'at'
      for (; i < end && ! Character.isWhitespace(array[i]); i++) {
        fun.append(array[i]);
      }

      if (! fun.endsWith("at")) {
        for (i = start; i < end; i++) {
          buf.append(array[i]);
        }
        i = end + 1;

        buf.append('\n');

        continue;
      }

      for (; i < end && Character.isWhitespace(array[i]); i++) {
      }

      fun.clear();
      for (; i < end && ! Character.isWhitespace(array[i]) &&
             array[i] != '('; i++) {
        fun.append(array[i]);
      }

      if (i < end && array[i] == '(')
        i++;

      for (; i < end && ! Character.isWhitespace(array[i]) &&
             array[i] != ':' && array[i] != ')'; i++) {
        file.append(array[i]);
      }
      
      int line = -1;
      if (i < end && array[i] == ':') {
        line = 0;
        for (i++; i < end && array[i] >= '0' && array[i] <= '9'; i++) {
          line = 10 * line + array[i] - '0';
        }
      }

      for (; i < end && ! Character.isWhitespace(array[i]) &&
             array[i] != ':' && array[i] != ')'; i++) {
        file.append(array[i]);
      }

      buf.append("\tat ");
      buf.append(fun);
      buf.append("(");
      String dstFile = file.toString();

      if (dstFile.equals(_dstFilename)) {
        convertError(buf, line);
      }
      else {
        buf.append(file);
        if (line > 0) {
          buf.append(":");
          buf.append(line);
        }
      }
      buf.append(array, i, end - i);
      buf.append('\n');
      i = end + 1;
    }

    return buf;
  }
341664
def _unicode(p):
    
    q = {}
    for tag in p:
        vals = []
        for v in p[tag]:
            if type(v) is not str:                                                              # pragma: no cover
                v = v.decode('utf-8')
            vals.append(v)
        if type(tag) is not str:                                                                # pragma: no cover
            tag = tag.decode('utf-8')
        q[tag] = vals
    return q
741871
function __deserializeArrayBuffer(buffer, start, options) {
	let end = start + 4;
	let [length] = new Uint32Array(buffer.slice(start, end));
	
	end = end + length;
	return {anchor:end, value:buffer.slice(start+4, end)};
}
274298
function binaryStringToArrayBuffer(bin) {
  var length = bin.length;
  var buf = new ArrayBuffer(length);
  var arr = new Uint8Array(buf);
  for (var i = 0; i < length; i++) {
    arr[i] = bin.charCodeAt(i);
  }
  return buf;
}
330227
public static String toHexString(ByteBuffer buffer) {
        if (buffer == null)
            return "null";
        return TypeUtils.toHexString(toArray(buffer));
    }
1040778
function (str) {

        // Max size of 1 character is 4 bytes
        var bytes = new Uint8Array(new ArrayBuffer(str.length * 4));

        var i = 0, j = 0;

        while (i < str.length) {
            var unicode_code;

            var utf16_code = str.charCodeAt(i++);
            if (utf16_code >= 0xD800 && utf16_code <= 0xDBFF) {
                // surrogate pair
                var upper = utf16_code;           // high surrogate
                var lower = str.charCodeAt(i++);  // low surrogate

                if (lower >= 0xDC00 && lower <= 0xDFFF) {
                    unicode_code =
                        (upper - 0xD800) * (1 << 10) + (1 << 16) +
                        (lower - 0xDC00);
                } else {
                    // malformed surrogate pair
                    return null;
                }
            } else {
                // not surrogate code
                unicode_code = utf16_code;
            }

            if (unicode_code < 0x80) {
                // 1-byte
                bytes[j++] = unicode_code;

            } else if (unicode_code < (1 << 11)) {
                // 2-byte
                bytes[j++] = (unicode_code >>> 6) | 0xC0;
                bytes[j++] = (unicode_code & 0x3F) | 0x80;

            } else if (unicode_code < (1 << 16)) {
                // 3-byte
                bytes[j++] = (unicode_code >>> 12) | 0xE0;
                bytes[j++] = ((unicode_code >> 6) & 0x3f) | 0x80;
                bytes[j++] = (unicode_code & 0x3F) | 0x80;

            } else if (unicode_code < (1 << 21)) {
                // 4-byte
                bytes[j++] = (unicode_code >>> 18) | 0xF0;
                bytes[j++] = ((unicode_code >> 12) & 0x3F) | 0x80;
                bytes[j++] = ((unicode_code >> 6) & 0x3F) | 0x80;
                bytes[j++] = (unicode_code & 0x3F) | 0x80;

            } else {
                // malformed UCS4 code
            }
        }

        return bytes.subarray(0, j);
    }
134819
public static char[] bytesToCharArrayUTFNIO(byte[] buffer) {
        ByteBuffer byteBuffer = ByteBuffer.wrap(buffer);
        CharBuffer charBuffer = Charset.forName(ENCODING).decode(byteBuffer);
        try {
            return charBufferToChars(charBuffer);
        } finally {
            eraseCharBuffer(charBuffer);
        }
    }
876544
function(arrayBuffer) {
	this.bytes = new Uint8Array(arrayBuffer);
	this.length = this.bytes.length;
	this.writePos = this.bytes.length;
	this.index = 0;
}
1211158
static String dbgBuffer(ByteBuffer b, int size) {
    StringBuilder sb = new StringBuilder();
    byte[] bytes = b.array();
    for (int i = 0; i < size; i++) {
      char ch = (char) bytes[i];
      if (Character.isWhitespace(ch) || Character.isLetterOrDigit(ch)) {
        sb.append(ch);
      } else {
        sb.append("\\x");
        sb.append(Integer.toHexString(bytes[i] & 0xff));
      }
    }
    return sb.toString();
  }
757345
function toArrayBuffer(buf) {
  if (buf instanceof ArrayBuffer) {
    return buf;
  } else if (Buffer.isBuffer(buf)) {
    return bufferToArrayBuffer(buf);
  } else if (buf instanceof Uint8Array) {
    return bufferToArrayBuffer(buf);
  } else {
    return buf; // type unknown, trust the user
  }
}
1183369
private int getSeparatorIndex(ByteBuffer buf) {
        int colon = BufferUtils.indexOf(buf, (byte) ':');
        if (colon == -1) {
            throw new IllegalStateException("Unknown encoding format: " + ByteBufferUtil.bytesToHex(buf));
        }
        return colon;
    }
27183
function isArrayBuffer (obj) {
  return obj instanceof ArrayBuffer ||
    (obj != null && obj.constructor != null && obj.constructor.name === 'ArrayBuffer' &&
      typeof obj.byteLength === 'number')
}
156605
public String readUTFAsArray() throws IOException {
		byte[] buffer = new byte[super.readInt()];
		super.read(buffer, 0, buffer.length);
		return new String(buffer, "UTF-8");
	}
452466
function str2ab (str) {
  var buf = new ArrayBuffer(str.length * 2) // 2 bytes for each char
  var bufView = new Uint16Array(buf)
  for (var i = 0, strLen = str.length; i < strLen; i++) {
    bufView[i] = str.charCodeAt(i)
  }
  return new Uint8Array(buf)
  /*var idx, len = str.length, arr = new Array( len );
   for ( idx = 0 ; idx < len ; ++idx ) {
       arr[ idx ] = str.charCodeAt(idx) & 0xFF;
   }
   // You may create an ArrayBuffer from a standard array (of values) as follows:
   return new Uint8Array( arr )*/
}
808915
function (buffer) {
        var header = new Uint32Array(buffer, 0, 4);
        if (header[0] !== 0x46546C67) {
            this.trigger('error', 'Invalid glTF binary format: Invalid header');
            return;
        }
        if (header[0] < 2) {
            this.trigger('error', 'Only glTF2.0 is supported.');
            return;
        }

        var dataView = new DataView(buffer, 12);

        var json;
        var buffers = [];
        // Read chunks
        for (var i = 0; i < dataView.byteLength;) {
            var chunkLength = dataView.getUint32(i, true);
            i += 4;
            var chunkType = dataView.getUint32(i, true);
            i += 4;

            // json
            if (chunkType === 0x4E4F534A) {
                var arr = new Uint8Array(buffer, i + 12, chunkLength);
                // TODO, for the browser not support TextDecoder.
                var decoder = new TextDecoder();
                var str = decoder.decode(arr);
                try {
                    json = JSON.parse(str);
                }
                catch (e) {
                    this.trigger('error', 'JSON Parse error:' + e.toString());
                    return;
                }
            }
            else if (chunkType === 0x004E4942) {
                buffers.push(buffer.slice(i + 12, i + 12 + chunkLength));
            }

            i += chunkLength;
        }
        if (!json) {
            this.trigger('error', 'Invalid glTF binary format: Can\'t find JSON.');
            return;
        }

        return this.parse(json, buffers);
    }
544340
function asBuffer(data, encoding) {
    let result = data;
    if (!isNullOrUndefined(result)) {
        if ('object' !== typeof result) {
            // handle as string
            encoding = normalizeString(encoding);
            if (!encoding) {
                encoding = 'utf8';
            }
            result = new Buffer(toStringSafe(result), encoding);
        }
    }
    return result;
}