KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using JNI code in an Android project in which the JNI native function requires a short[] argument. However, the original data is stored as a ByteBuffer. I'm trying the convert the data format as follows. ByteBuffer rgbBuf = ByteBuffer.allocate(size); ... short[] shortArray = (short[]) rgbBuf.asShortBuffer().array().clone(); But I encounter the following problem when running the second line of code shown above: E/AndroidRuntime(23923): Caused by: java.lang.UnsupportedOperationException E/AndroidRuntime(23923): at Java.nio.ShortToByteBufferAdapter.protectedArray(ShortToByteBufferAdapter.java:169) Could anyone suggest a means to implement the conversion?
Tags (comma-separated)
Save Edits
Cancel