< prev index next >
src/java.base/unix/classes/sun/nio/fs/UnixChannelFactory.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 62,71 ****
--- 62,72 ----
boolean create;
boolean createNew;
boolean deleteOnClose;
boolean sync;
boolean dsync;
+ boolean direct;
static Flags toFlags(Set<? extends OpenOption> options) {
Flags flags = new Flags();
for (OpenOption option: options) {
if (option instanceof StandardOpenOption) {
*** 86,95 ****
--- 87,102 ----
}
if (option == LinkOption.NOFOLLOW_LINKS && O_NOFOLLOW != 0) {
flags.noFollowLinks = true;
continue;
}
+
+ if (ExtendedOptions.DIRECT.matches(option)) {
+ flags.direct = true;
+ continue;
+ }
+
if (option == null)
throw new NullPointerException();
throw new UnsupportedOperationException(option + " not supported");
}
return flags;
*** 132,142 ****
throw new IllegalArgumentException("READ + APPEND not allowed");
if (flags.append && flags.truncateExisting)
throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
FileDescriptor fdObj = open(dfd, path, pathForPermissionCheck, flags, mode);
! return FileChannelImpl.open(fdObj, path.toString(), flags.read, flags.write, null);
}
/**
* Constructs a file channel by opening the given file.
*/
--- 139,150 ----
throw new IllegalArgumentException("READ + APPEND not allowed");
if (flags.append && flags.truncateExisting)
throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
FileDescriptor fdObj = open(dfd, path, pathForPermissionCheck, flags, mode);
! return FileChannelImpl.open(fdObj, path.toString(), flags.read,
! flags.write, flags.direct, null);
}
/**
* Constructs a file channel by opening the given file.
*/
*** 233,242 ****
--- 241,252 ----
if (flags.dsync)
oflags |= O_DSYNC;
if (flags.sync)
oflags |= O_SYNC;
+ if (flags.direct)
+ oflags |= O_DIRECT;
// permission check before we open the file
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
if (pathForPermissionCheck == null)
< prev index next >