React Typescript API Type for Java byte[] image/png



我正在将它转换为React web应用程序的Typescript服务。下面是Java的原始API。Typescript Response的数据类型是什么?团吗?

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

与Javabyte类型等价的JS类型是Int8Array。因为Java的byte是一个有符号的8位整数。

const byteArray = new Int8Array(new ArrayBuffer(arrayOfInts));

按类型数组

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

最新更新