static java.nio.MappedByteBuffer | getBuffer(org.apache.harmony.luni.platform.PlatformAddress addr, int mapmode, long size, int offset)
constructor = AccessController
.doPrivileged(new PrivilegedAction<Constructor>() {
public Constructor run() {
try {
Class wrapperClazz = ClassLoader
.getSystemClassLoader().loadClass(
"java.nio.MappedByteBufferAdapter"); //$NON-NLS-1$
Constructor result = wrapperClazz
.getConstructor(new Class[] {
PlatformAddress.class, int.class,
int.class, int.class });
result.setAccessible(true);
return result;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
// Spec points out explicitly that the size of map should be no greater than
// Integer.MAX_VALUE, so long to int cast is safe here.
return (MappedByteBuffer) constructor.newInstance(new Object[] { addr,
new Integer((int) size), new Integer(offset),
new Integer(mapmode) });
|