src/share/classes/java/nio/channels/AsynchronousFileChannel.java

Print this page




 231      *          If an I/O error occurs
 232      * @throws  SecurityException
 233      *          If a security manager is installed and it denies an
 234      *          unspecified permission required by the implementation.
 235      *          In the case of the default provider, the {@link
 236      *          SecurityManager#checkRead(String)} method is invoked to check
 237      *          read access if the file is opened for reading. The {@link
 238      *          SecurityManager#checkWrite(String)} method is invoked to check
 239      *          write access if the file is opened for writing
 240      */
 241     public static AsynchronousFileChannel open(Path file,
 242                                                Set<? extends OpenOption> options,
 243                                                ExecutorService executor,
 244                                                FileAttribute<?>... attrs)
 245         throws IOException
 246     {
 247         FileSystemProvider provider = file.getFileSystem().provider();
 248         return provider.newAsynchronousFileChannel(file, options, executor, attrs);
 249     }
 250 
 251     @SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction
 252     private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
 253 
 254     /**
 255      * Opens or creates a file for reading and/or writing, returning an
 256      * asynchronous file channel to access the file.
 257      *
 258      * <p> An invocation of this method behaves in exactly the same way as the
 259      * invocation
 260      * <pre>
 261      *     ch.{@link #open(Path,Set,ExecutorService,FileAttribute[])
 262      *       open}(file, opts, null, new FileAttribute&lt;?&gt;[0]);
 263      * </pre>
 264      * where {@code opts} is a {@code Set} containing the options specified to
 265      * this method.
 266      *
 267      * <p> The resulting channel is associated with default thread pool to which
 268      * tasks are submitted to handle I/O events and dispatch to completion
 269      * handlers that consume the result of asynchronous operations performed on
 270      * the resulting channel.
 271      *




 231      *          If an I/O error occurs
 232      * @throws  SecurityException
 233      *          If a security manager is installed and it denies an
 234      *          unspecified permission required by the implementation.
 235      *          In the case of the default provider, the {@link
 236      *          SecurityManager#checkRead(String)} method is invoked to check
 237      *          read access if the file is opened for reading. The {@link
 238      *          SecurityManager#checkWrite(String)} method is invoked to check
 239      *          write access if the file is opened for writing
 240      */
 241     public static AsynchronousFileChannel open(Path file,
 242                                                Set<? extends OpenOption> options,
 243                                                ExecutorService executor,
 244                                                FileAttribute<?>... attrs)
 245         throws IOException
 246     {
 247         FileSystemProvider provider = file.getFileSystem().provider();
 248         return provider.newAsynchronousFileChannel(file, options, executor, attrs);
 249     }
 250 
 251     @SuppressWarnings({"unchecked", "rawtypes"}) // generic array construction
 252     private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
 253 
 254     /**
 255      * Opens or creates a file for reading and/or writing, returning an
 256      * asynchronous file channel to access the file.
 257      *
 258      * <p> An invocation of this method behaves in exactly the same way as the
 259      * invocation
 260      * <pre>
 261      *     ch.{@link #open(Path,Set,ExecutorService,FileAttribute[])
 262      *       open}(file, opts, null, new FileAttribute&lt;?&gt;[0]);
 263      * </pre>
 264      * where {@code opts} is a {@code Set} containing the options specified to
 265      * this method.
 266      *
 267      * <p> The resulting channel is associated with default thread pool to which
 268      * tasks are submitted to handle I/O events and dispatch to completion
 269      * handlers that consume the result of asynchronous operations performed on
 270      * the resulting channel.
 271      *