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

Print this page
rev 6099 : [mq]: io-trace


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




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