javascript - Converting byte[] to ArrayBuffer in Nashorn -
how convert array of bytes arraybuffer
in nashorn? trying insert binary data pure javascript environment (i.e., doesn't have access java.from
or java.to
) , create instance out array of bytes.
looks going wrong way. made more sense convert uint8array
since i'm sending in is array of bytes.
i created following function:
function bytetouint8array(bytearray) { var uint8array = new uint8array(bytearray.length); for(var = 0; < uint8array.length; i++) { uint8array[i] = bytearray[i]; } return uint8array; }
this convert array of bytes (so bytearray
of type byte[]
) uint8array
.
Comments
Post a Comment