We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java
public JSObject getMsg() { JSObject data = context.createNewJSObject(); byte[] buffer = new byte[]{31, -117, 8, 0, 0, 0, 0, 0, 0, -1, 109, -112, 79, 79, -125, 64, 20, -60, -65, 11, -90, 55, -17, -20, -82, -91, -48, 27, -108, 63, -59, -12, -45, 98, -128, 10}; data.setProperty("msg", new String(buffer, StandardCharsets.UTF_8)); return data; } public void test(String text, int length) { int len = text.length(); byte[] buffer = text.getBytes(StandardCharsets.UTF_8); int len2 = buffer.length; }
js
const data = getMsg() console.log(data) test(data.msg, data.msg.length)
结果
The text was updated successfully, but these errors were encountered:
下个版本会支持 byte[] 类型(预计下周),已提 PR #84 ,后面建议使用这种方式处理
Sorry, something went wrong.
主要是有个接口把 gzip压缩数据放到json中了,所以想在不转换的情况直接转到java结果有问题。
const rawBuf = new Uint8Array(data.msg.length); for (let i = 0; i < data.msg.length; i++) rawBuf[i] = data.msg.charCodeAt(i);
如果字符串不支持只能这样转换了
好的,你这个 case 我需要再看一下
No branches or pull requests
java
js
结果
The text was updated successfully, but these errors were encountered: