Skip to content
New issue

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 byte写入js的ArrayBuffer? #55

Open
18si opened this issue Jul 19, 2023 · 6 comments
Open

能否支持Java byte写入js的ArrayBuffer? #55

18si opened this issue Jul 19, 2023 · 6 comments

Comments

@18si
Copy link

18si commented Jul 19, 2023

有没有办法直接创建一个 Uint8Array 或 ArrayBuffer 的 JS 值?这个ArrayBuffer可以通过java来写入和读取?

目前只有JSArray ,只能

JSArray array = context.createNewJSArray();
for (int i = 0; i < bytes.length; i++) array.set((int) bytes[i], i);

这样大数据会非常慢。

@HarlonWang
Copy link
Owner

需要处理下两种类型转换,我会在放到支持计划中

@18si 18si closed this as completed Sep 12, 2023
@FongMi
Copy link

FongMi commented Sep 18, 2023

大佬這個支持了嗎?

@HarlonWang HarlonWang reopened this Sep 20, 2023
@HarlonWang
Copy link
Owner

还没有支持,你这边有需要的话,可以再描述下需要支持的场景吗?或者给个示例说明

@FongMi
Copy link

FongMi commented Sep 20, 2023

就是 java 的 okhttp 的 response 可以是 byte array,js 這邊希望可以直接處理這個 byte array。
https://github.com/FongMi/TV/blob/release/quickjs/src/main/java/com/fongmi/quickjs/utils/Connect.java#L39
目前是用 for each 轉成 int,但是效率太慢。
https://github.com/FongMi/TV/blob/release/quickjs/src/main/java/com/fongmi/quickjs/utils/JSUtil.java#L19

@HarlonWang
Copy link
Owner

好的,计划要10月份支持了

@HarlonWang HarlonWang added the help wanted Extra attention is needed label Sep 21, 2023
@jbactb
Copy link

jbactb commented Sep 23, 2024

大佬什么时候能支持ArrayBuffer?

@HarlonWang HarlonWang added Will be fixed in next release and removed help wanted Extra attention is needed labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants