I’m working on the Java Multimedia IO Project and have run into a problem, when ever I try writing a DWORD it turns out to be 16 bytes in length instead of 4 bytes. I’m using the following code to convert a 4 char string into a 16 bit little endian byte array;
word.getBytes("UTF-32LE")
If some chould please tell me why the array is longer that 4 bytes.
Thanks,
Liam.
Because you are encoding into a format (UTF-32) that takes 4 bytes per character See description here
If you want it to be a byte per character use “UTF-8” instead of “UTF-32LE”