@@ -729,14 +729,50 @@ private static <R, A> R filterPaths(final PathFilter filter, final Stream<Path>
729729 * @since 2.8.0
730730 */
731731 public static List <AclEntry > getAclEntryList (final Path sourcePath ) throws IOException {
732- final AclFileAttributeView fileAttributeView = Files . getFileAttributeView (sourcePath , AclFileAttributeView . class );
732+ final AclFileAttributeView fileAttributeView = getAclFileAttributeView (sourcePath );
733733 return fileAttributeView == null ? null : fileAttributeView .getAcl ();
734734 }
735735
736+ /**
737+ * Shorthand for {@code Files.getFileAttributeView(path, AclFileAttributeView.class)}.
738+ *
739+ * @param path the path to the file.
740+ * @param options how to handle symbolic links.
741+ * @return a AclFileAttributeView, or {@code null} if the attribute view type is not available.
742+ * @since 2.12.0
743+ */
744+ public static AclFileAttributeView getAclFileAttributeView (final Path path , final LinkOption ... options ) {
745+ return Files .getFileAttributeView (path , AclFileAttributeView .class , options );
746+ }
747+
748+ /**
749+ * Shorthand for {@code Files.getFileAttributeView(path, DosFileAttributeView.class)}.
750+ *
751+ * @param path the path to the file.
752+ * @param options how to handle symbolic links.
753+ * @return a DosFileAttributeView, or {@code null} if the attribute view type is not available.
754+ * @since 2.12.0
755+ */
756+ public static DosFileAttributeView getDosFileAttributeView (final Path path , final LinkOption ... options ) {
757+ return Files .getFileAttributeView (path , DosFileAttributeView .class , options );
758+ }
759+
736760 private static FileTime getLastModifiedTime (final Path path , final LinkOption ... options ) throws IOException {
737761 return Files .getLastModifiedTime (Objects .requireNonNull (path , "path" ), options );
738762 }
739763
764+ /**
765+ * Shorthand for {@code Files.getFileAttributeView(path, PosixFileAttributeView.class)}.
766+ *
767+ * @param path the path to the file.
768+ * @param options how to handle symbolic links.
769+ * @return a PosixFileAttributeView, or {@code null} if the attribute view type is not available.
770+ * @since 2.12.0
771+ */
772+ public static PosixFileAttributeView getPosixFileAttributeView (final Path path , final LinkOption ... options ) {
773+ return Files .getFileAttributeView (path , PosixFileAttributeView .class , options );
774+ }
775+
740776 /**
741777 * Gets a {@link Path} representing the system temporary directory.
742778 *
@@ -915,6 +951,7 @@ public static boolean isOlder(final Path file, final Instant instant, final Link
915951 return isOlder (file , FileTime .from (instant ), options );
916952 }
917953
954+
918955 /**
919956 * Tests if the given {@code Path} is older than the given time reference.
920957 *
@@ -943,7 +980,6 @@ public static boolean isOlder(final Path file, final Path reference) throws IOEx
943980 return isOlder (file , getLastModifiedTime (reference ));
944981 }
945982
946-
947983 /**
948984 * Tests whether the given {@code Path} is a regular file or not. Implemented as a null-safe delegate to
949985 * {@code Files.isRegularFile(Path path, LinkOption... options)}.
@@ -1152,7 +1188,7 @@ public static void setLastModifiedTime(final Path sourceFile, final Path targetF
11521188 */
11531189 public static Path setReadOnly (final Path path , final boolean readOnly , final LinkOption ... linkOptions ) throws IOException {
11541190 final List <Exception > causeList = new ArrayList <>(2 );
1155- final DosFileAttributeView fileAttributeView = Files . getFileAttributeView (path , DosFileAttributeView . class , linkOptions );
1191+ final DosFileAttributeView fileAttributeView = getDosFileAttributeView (path , linkOptions );
11561192 if (fileAttributeView != null ) {
11571193 // Windows 10
11581194 try {
@@ -1163,7 +1199,7 @@ public static Path setReadOnly(final Path path, final boolean readOnly, final Li
11631199 causeList .add (e );
11641200 }
11651201 }
1166- final PosixFileAttributeView posixFileAttributeView = Files . getFileAttributeView (path , PosixFileAttributeView . class , linkOptions );
1202+ final PosixFileAttributeView posixFileAttributeView = getPosixFileAttributeView (path , linkOptions );
11671203 if (posixFileAttributeView != null ) {
11681204 // Not Windows 10
11691205 final PosixFileAttributes readAttributes = posixFileAttributeView .readAttributes ();
0 commit comments