Resize a byte array
In a nat开发者_StackOverflow社区ive function with a jbyteArray argument, I want to pass data back into the calling app using SetByteArrayRegion.
I would like to resize the array to exactly fit the data, is that possible?
You can't. Arrays are fixed size in java.
Possible solution would be to use a different data structure (e.g. ArrayList) or you could create a jbyteArray of the correct size and let the native function return this.
No, that is not possible, just as you can't resize arrays in java.
You need to create and return new array.
精彩评论