< prev index next >

src/java.base/windows/classes/sun/nio/fs/WindowsChannelFactory.java

Print this page

149         throws WindowsException
150     {
151         Flags flags = Flags.toFlags(options);
152 
153         // default is reading; append => writing
154         if (!flags.read && !flags.write) {
155             if (flags.append) {
156                 flags.write = true;
157             } else {
158                 flags.read = true;
159             }
160         }
161 
162         // validation
163         if (flags.read && flags.append)
164             throw new IllegalArgumentException("READ + APPEND not allowed");
165         if (flags.append && flags.truncateExisting)
166             throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
167 
168         FileDescriptor fdObj = open(pathForWindows, pathToCheck, flags, pSecurityDescriptor);
169         return FileChannelImpl.open(fdObj, pathForWindows, flags.read,
170                 flags.write, flags.direct, null);
171     }
172 
173     /**
174      * Open/creates file, returning AsynchronousFileChannel to access the file
175      *
176      * @param   pathForWindows
177      *          The path of the file to open/create
178      * @param   pathToCheck
179      *          The path used for permission checks (if security manager)
180      * @param   pool
181      *          The thread pool that the channel is associated with
182      */
183     static AsynchronousFileChannel newAsynchronousFileChannel(String pathForWindows,
184                                                               String pathToCheck,
185                                                               Set<? extends OpenOption> options,
186                                                               long pSecurityDescriptor,
187                                                               ThreadPool pool)
188         throws IOException
189     {
190         Flags flags = Flags.toFlags(options);

149         throws WindowsException
150     {
151         Flags flags = Flags.toFlags(options);
152 
153         // default is reading; append => writing
154         if (!flags.read && !flags.write) {
155             if (flags.append) {
156                 flags.write = true;
157             } else {
158                 flags.read = true;
159             }
160         }
161 
162         // validation
163         if (flags.read && flags.append)
164             throw new IllegalArgumentException("READ + APPEND not allowed");
165         if (flags.append && flags.truncateExisting)
166             throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
167 
168         FileDescriptor fdObj = open(pathForWindows, pathToCheck, flags, pSecurityDescriptor);
169         return FileChannelImpl.open(fdObj, pathForWindows, flags.read, flags.write,
170                 (flags.sync || flags.dsync), flags.direct, null);
171     }
172 
173     /**
174      * Open/creates file, returning AsynchronousFileChannel to access the file
175      *
176      * @param   pathForWindows
177      *          The path of the file to open/create
178      * @param   pathToCheck
179      *          The path used for permission checks (if security manager)
180      * @param   pool
181      *          The thread pool that the channel is associated with
182      */
183     static AsynchronousFileChannel newAsynchronousFileChannel(String pathForWindows,
184                                                               String pathToCheck,
185                                                               Set<? extends OpenOption> options,
186                                                               long pSecurityDescriptor,
187                                                               ThreadPool pool)
188         throws IOException
189     {
190         Flags flags = Flags.toFlags(options);
< prev index next >