--- a/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java Fri Oct 20 11:08:18 2017 -0700
+++ b/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java Tue Oct 17 16:51:11 2017 -0700
@@ -30,6 +30,8 @@
import jdk.internal.misc.SharedSecrets;
import jdk.internal.misc.JavaIOFileDescriptorAccess;
import sun.security.action.GetPropertyAction;
+import java.io.File;
+import java.nio.CharBuffer;
class FileDispatcherImpl extends FileDispatcher {
@@ -123,6 +125,21 @@
return true;
}
+ int setDirectIO(FileDescriptor fd, String path)
+ {
+ int result = -1;
+ String filePath = path.substring(0, path.lastIndexOf(File.separator));
+ CharBuffer buffer = CharBuffer.allocate(filePath.length());
+ buffer.put(filePath);
+ try {
+ result = setDirect0(fd, buffer);
+ } catch (IOException e) {
+ throw new UnsupportedOperationException
+ ("Error setting up DirectIO", e);
+ }
+ return result;
+ }
+
static boolean isFastFileTransferRequested() {
String fileTransferProp = GetPropertyAction
.privilegedGetProperty("jdk.nio.enableFastFileTransfer");
@@ -177,4 +194,6 @@
static native void close0(FileDescriptor fd) throws IOException;
static native long duplicateHandle(long fd) throws IOException;
+
+ static native int setDirect0(FileDescriptor fd, CharBuffer buffer) throws IOException;
}