Closed blambov closed 10 years ago
Unfortunately there doesn't seem to be a clean way to access read-only heap buffers for JNI. Rather than depend on Unsafe machinery I chose to leave this option unsupported.
If you prefer something else, let me know. I'm also not sure if it makes sense for the Unsafe implementations to support read-only heap buffers if the JNI ones don't; I can remove this part of the patch if you prefer.
I agree that the JNI impl should avoid relying on unsafe machinery. But it can also be surprising (in the bad way) that some ByteBuffer impls are not supported, so maybe it should just fall back to the safe Java implementation in the read-only heap buffer case?
No problem. Fallback added, using fastestJavaInstance().
Merged, thanks!
Adds forgotten range checks in JNI ByteBuffer methods. Fixes incorrect change of ByteBuffer state in Safe HC compressor.