Files { public static boolean isExecutable(final Path path) throws IllegalArgumentException, SecurityException { checkNotNull("path", path); try { providerOf(path).checkAccess(path, EXECUTE); return true; } catch (Exception x) { } return false; } private  Files(); static InputStream newInputStream(final Path path,
                                             final OpenOption... options); static OutputStream newOutputStream(final Path path,
                                               final OpenOption... options); static SeekableByteChannel newByteChannel(final Path path,
                                                     final OpenOption... options); static SeekableByteChannel newByteChannel(final Path path,
                                                     final Set<? extends OpenOption> options,
                                                     final FileAttribute<?>... attrs); static DirectoryStream<Path> newDirectoryStream(final Path dir); static DirectoryStream<Path> newDirectoryStream(final Path dir,
                                                           final String glob); static DirectoryStream<Path> newDirectoryStream(final Path dir,
                                                           final DirectoryStream.Filter<Path> filter); static Path createFile(final Path path,
                                  final FileAttribute<?>... attrs); static Path createDirectory(final Path dir,
                                       final FileAttribute<?>... attrs); static Path createDirectories(final Path dir,
                                         final FileAttribute<?>... attrs); static Path createSymbolicLink(final Path link,
                                          final Path target,
                                          final FileAttribute<?>... attrs); static Path createLink(final Path link,
                                  final Path existing); static void delete(final Path path,
                              final DeleteOption... options); static boolean deleteIfExists(final Path path,
                                         final DeleteOption... options); static Path createTempFile(final String prefix,
                                      final String suffix,
                                      final FileAttribute<?>... attrs); static Path createTempFile(final Path dir,
                                      final String prefix,
                                      final String suffix,
                                      final FileAttribute<?>... attrs); static Path createTempDirectory(final String prefix,
                                           final FileAttribute<?>... attrs); static Path createTempDirectory(final Path dir,
                                           final String prefix,
                                           final FileAttribute<?>... attrs); static Path copy(final Path source,
                            final Path target,
                            final CopyOption... options); static Path move(final Path source,
                            final Path target,
                            final CopyOption... options); static Path readSymbolicLink(final Path link); static FileStore getFileStore(final Path path); static String probeContentType(final Path path); static V getFileAttributeView(final Path path,
                                                                       final Class<V> type,
                                                                       final LinkOption... options); static A readAttributes(final Path path,
                                                                   final Class<A> type,
                                                                   final LinkOption... options); static Map<String, Object> readAttributes(final Path path,
                                                     final String attributes,
                                                     final LinkOption... options); static Path setAttribute(final Path path,
                                    final String attribute,
                                    final Object value,
                                    final LinkOption... options); static Object getAttribute(final Path path,
                                      final String attribute,
                                      final LinkOption... options); static Set<PosixFilePermission> getPosixFilePermissions(final Path path,
                                                                   final LinkOption... options); static Path setPosixFilePermissions(final Path path,
                                               final Set<PosixFilePermission> perms); static UserPrincipal getOwner(final Path path,
                                         final LinkOption... options); static Path setOwner(final Path path,
                                final UserPrincipal owner); static FileTime getLastModifiedTime(final Path path,
                                               final LinkOption... options); static Path setLastModifiedTime(final Path path,
                                           final FileTime time); static long size(final Path path); static boolean exists(final Path path,
                                 final LinkOption... options); static boolean notExists(final Path path,
                                    final LinkOption... options); static boolean isSameFile(final Path path,
                                     final Path path2); static boolean isHidden(final Path path); static boolean isReadable(final Path path); static boolean isWritable(final Path path); static boolean isExecutable(final Path path); static boolean isSymbolicLink(final Path path); static boolean isDirectory(final Path path,
                                      final LinkOption... options); static boolean isRegularFile(final Path path,
                                        final LinkOption... options); static Path walkFileTree(final Path start,
                                    final Set<FileVisitOption> options,
                                    final int maxDepth,
                                    final FileVisitor<Path> visitor); static Path walkFileTree(final Path start,
                                    final FileVisitor<Path> visitor); static BufferedReader newBufferedReader(final Path path,
                                                   final Charset cs); static BufferedWriter newBufferedWriter(final Path path,
                                                   final Charset cs,
                                                   final OpenOption... options); static long copy(final InputStream in,
                            final Path target,
                            final CopyOption... options); static long copy(final Path source,
                            final OutputStream out); static byte[] readAllBytes(final Path path); static List<String> readAllLines(final Path path,
                                            final Charset cs); static Path write(final Path path,
                             final byte[] bytes,
                             final OpenOption... options); static Path write(final Path path,
                             final Iterable<? extends CharSequence> lines,
                             final Charset cs,
                             final OpenOption... options);  }
@Test public void isExecutable() { Assume.assumeFalse(SimpleFileSystemProvider.OSType.currentOS().equals(SimpleFileSystemProvider.OSType.WINDOWS)); final Path path = Files.createTempFile("foo", "bar"); assertThat(Files.isExecutable(path)).isFalse(); assertThat(Files.isExecutable(newTempDir())).isTrue(); assertThat(Files.isExecutable(Paths.get("/some/file"))).isFalse(); }
@Test public void isExecutableNull() { assertThatThrownBy(() -> Files.isExecutable(null)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Parameter named 'path' should be not null!"); }