【问题标题】:React Typescript API Type for Java byte[] image/png用于 Java byte[] image/png 的 React Typescript API 类型
【发布时间】:2022-11-17 05:18:40
【问题描述】:

我正在将其转换为我们的 React Web 应用程序的 Typescript 服务。以下是 Java 中的原始 API。什么是 Typescript Response 数据类型?斑点?

@GET
@Path("/{vendorId}/Photo}")
@Produces("image/png")
byte[] getVendorPhoto(@PathVariable long vendorId);

【问题讨论】:

    标签: reactjs typescript


    【解决方案1】:

    通过 typed array

    const idView = new Uint32Array(buffer, 0, 1);
    const usernameView = new Uint8Array(buffer, 4, 16);
    const amountDueView = new Float32Array(buffer, 20, 1);
    

    【讨论】:

    • 所以对于我上面的例子,byte[] image/png,我应该使用 Uint32、Float32、Unit8 吗? 3 个选项中最好的选项是什么?
    • @mattsmith5 实际上,这取决于你的情况。也许试试 float32。
    • 你好,请问是什么条件?我应该注意什么?
    猜你喜欢
    • 2012-08-28
    • 1970-01-01
    • 2013-02-17
    • 1970-01-01
    • 2017-06-07
    • 2022-08-07
    • 2017-11-01
    • 2012-10-28
    • 2022-12-11
    相关资源
    最近更新 更多