Patch: java.nio.DirectBufferImpl.shiftDown()
Per Bothner
per@bothner.com
Wed Apr 21 14:10:00 GMT 2004
Michael Koch wrote:
> Hi list,
>
>
> On request of some people using java.nio with JNI I made
> java.nio.DirectBufferImpl.shiftDown() static and removed an unecessary
> usage of array_offset which is always 0 for direct buffers and is
> intended only for buffers with backend arrays.
>
> Per: whats your opinion about this ?
But what about a ShortViewBufferImpl that is created by calling
asShortBuffer on a DirectBufferImpl? You're now using the slow
shiftDown implementation in ByteBuffer instead of the much
faster native method.
Why do some implementations need DirectBufferImpl.shiftDown to
be static?
A possible solution: To your patch add to DirectBufferImpl:
void shiftDown (int dst_offset, int src_offset, int count)
{
shiftDown(address, dst_offset, srd_offset, count);
}
Same thing in MappedByteBuffer:
void shiftDown (int dst_offset, int src_offset, int count)
{
DirectByteBufferImpl.shiftDown(address, dst_offset, srd_offset, count);
}
--
--Per Bothner
per@bothner.com http://per.bothner.com/
More information about the Java-patches
mailing list