diff --git a/jdk/src/java.base/share/classes/java/nio/file/Files.java b/jdk/src/java.base/share/classes/java/nio/file/Files.java index ba18b6c9e30..18ef214e9a0 100644 --- a/jdk/src/java.base/share/classes/java/nio/file/Files.java +++ b/jdk/src/java.base/share/classes/java/nio/file/Files.java @@ -303,7 +303,7 @@ public final class Files { * is a {@link java.nio.channels.FileChannel}. * *
Usage Examples: - *
+ ** * @param path * the path to the file to open or create @@ -1702,7 +1703,8 @@ public final class Files { * Alternatively, suppose we want to read file's POSIX attributes without * following symbolic links: *{@code * Path path = ... * * // open file for reading @@ -314,9 +314,10 @@ public final class Files { * WritableByteChannel wbc = Files.newByteChannel(path, EnumSet.of(CREATE,APPEND)); * * // create file with initial permissions, opening it for both reading and writing - * {@code FileAttribute+ * FileAttribute> perms = ...} - * SeekableByteChannel sbc = Files.newByteChannel(path, EnumSet.of(CREATE_NEW,READ,WRITE), perms); - * > perms = ... + * SeekableByteChannel sbc = + * Files.newByteChannel(path, EnumSet.of(CREATE_NEW,READ,WRITE), perms); + * }
- * PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class, NOFOLLOW_LINKS); + * PosixFileAttributes attrs = + * Files.readAttributes(path, PosixFileAttributes.class, NOFOLLOW_LINKS); ** * @param @@ -2840,6 +2842,8 @@ public final class Files { * @return a new buffered writer, with default buffer size, to write text * to the file * + * @throws IllegalArgumentException + * if {@code options} contains an invalid combination of options * @throws IOException * if an I/O error occurs opening or creating the file * @throws UnsupportedOperationException @@ -2880,6 +2884,8 @@ public final class Files { * @return a new buffered writer, with default buffer size, to write text * to the file * + * @throws IllegalArgumentException + * if {@code options} contains an invalid combination of options * @throws IOException * if an I/O error occurs opening or creating the file * @throws UnsupportedOperationException @@ -2891,7 +2897,9 @@ public final class Files { * * @since 1.8 */ - public static BufferedWriter newBufferedWriter(Path path, OpenOption... options) throws IOException { + public static BufferedWriter newBufferedWriter(Path path, OpenOption... options) + throws IOException + { return newBufferedWriter(path, StandardCharsets.UTF_8, options); } @@ -3273,6 +3281,8 @@ public final class Files { * * @return the path * + * @throws IllegalArgumentException + * if {@code options} contains an invalid combination of options * @throws IOException * if an I/O error occurs writing to or creating the file * @throws UnsupportedOperationException @@ -3330,6 +3340,8 @@ public final class Files { * * @return the path * + * @throws IllegalArgumentException + * if {@code options} contains an invalid combination of options * @throws IOException * if an I/O error occurs writing to or creating the file, or the * text cannot be encoded using the specified charset @@ -3376,6 +3388,8 @@ public final class Files { * * @return the path * + * @throws IllegalArgumentException + * if {@code options} contains an invalid combination of options * @throws IOException * if an I/O error occurs writing to or creating the file, or the * text cannot be encoded as {@code UTF-8} @@ -3452,7 +3466,7 @@ public final class Files { final Iterator
Unless otherwise noted, passing a {@code null} argument to a constructor * or method of any class or interface in this package will cause a {@link * java.lang.NullPointerException NullPointerException} to be thrown. Additionally, - * invoking a method with a collection containing a {@code null} element will - * cause a {@code NullPointerException}, unless otherwise specified.
+ * invoking a method with an array or collection containing a {@code null} element + * will cause a {@code NullPointerException}, unless otherwise specified. * *Unless otherwise noted, methods that attempt to access the file system * will throw {@link java.nio.file.ClosedFileSystemException} when invoked on