mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8338411: Implement JEP 486: Permanently Disable the Security Manager
Co-authored-by: Sean Mullan <mullan@openjdk.org> Co-authored-by: Alan Bateman <alanb@openjdk.org> Co-authored-by: Weijun Wang <weijun@openjdk.org> Co-authored-by: Aleksei Efimov <aefimov@openjdk.org> Co-authored-by: Brian Burkhalter <bpb@openjdk.org> Co-authored-by: Daniel Fuchs <dfuchs@openjdk.org> Co-authored-by: Harshitha Onkar <honkar@openjdk.org> Co-authored-by: Joe Wang <joehw@openjdk.org> Co-authored-by: Jorn Vernee <jvernee@openjdk.org> Co-authored-by: Justin Lu <jlu@openjdk.org> Co-authored-by: Kevin Walls <kevinw@openjdk.org> Co-authored-by: Lance Andersen <lancea@openjdk.org> Co-authored-by: Naoto Sato <naoto@openjdk.org> Co-authored-by: Roger Riggs <rriggs@openjdk.org> Co-authored-by: Brent Christian <bchristi@openjdk.org> Co-authored-by: Stuart Marks <smarks@openjdk.org> Co-authored-by: Ian Graves <igraves@openjdk.org> Co-authored-by: Phil Race <prr@openjdk.org> Co-authored-by: Erik Gahlin <egahlin@openjdk.org> Co-authored-by: Jaikiran Pai <jpai@openjdk.org> Reviewed-by: kevinw, aivanov, rriggs, lancea, coffeys, dfuchs, ihse, erikj, cjplummer, coleenp, naoto, mchung, prr, weijun, joehw, azvegint, psadhukhan, bchristi, sundar, attila
This commit is contained in:
parent
c12b386d19
commit
db85090553
1885 changed files with 5528 additions and 65650 deletions
|
@ -149,10 +149,6 @@ public final class Files {
|
|||
* if an unsupported option is specified
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*/
|
||||
public static InputStream newInputStream(Path path, OpenOption... options)
|
||||
throws IOException
|
||||
|
@ -214,13 +210,6 @@ public final class Files {
|
|||
* <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file. The {@link
|
||||
* SecurityManager#checkDelete(String) checkDelete} method is
|
||||
* invoked to check delete access if the file is opened with the
|
||||
* {@code DELETE_ON_CLOSE} option.
|
||||
*/
|
||||
public static OutputStream newOutputStream(Path path, OpenOption... options)
|
||||
throws IOException
|
||||
|
@ -359,16 +348,6 @@ public final class Files {
|
|||
* exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the path if the file is
|
||||
* opened for reading. The {@link SecurityManager#checkWrite(String)
|
||||
* checkWrite} method is invoked to check write access to the path
|
||||
* if the file is opened for writing. The {@link
|
||||
* SecurityManager#checkDelete(String) checkDelete} method is
|
||||
* invoked to check delete access if the file is opened with the
|
||||
* {@code DELETE_ON_CLOSE} option.
|
||||
*
|
||||
* @see java.nio.channels.FileChannel#open(Path,Set,FileAttribute[])
|
||||
*/
|
||||
|
@ -406,16 +385,6 @@ public final class Files {
|
|||
* exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the path if the file is
|
||||
* opened for reading. The {@link SecurityManager#checkWrite(String)
|
||||
* checkWrite} method is invoked to check write access to the path
|
||||
* if the file is opened for writing. The {@link
|
||||
* SecurityManager#checkDelete(String) checkDelete} method is
|
||||
* invoked to check delete access if the file is opened with the
|
||||
* {@code DELETE_ON_CLOSE} option.
|
||||
*
|
||||
* @see java.nio.channels.FileChannel#open(Path,OpenOption[])
|
||||
*/
|
||||
|
@ -471,10 +440,6 @@ public final class Files {
|
|||
* a directory <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the directory.
|
||||
*/
|
||||
public static DirectoryStream<Path> newDirectoryStream(Path dir)
|
||||
throws IOException
|
||||
|
@ -526,10 +491,6 @@ public final class Files {
|
|||
* a directory <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the directory.
|
||||
*/
|
||||
public static DirectoryStream<Path> newDirectoryStream(Path dir, String glob)
|
||||
throws IOException
|
||||
|
@ -602,10 +563,6 @@ public final class Files {
|
|||
* a directory <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the directory.
|
||||
*/
|
||||
public static DirectoryStream<Path> newDirectoryStream(Path dir,
|
||||
DirectoryStream.Filter<? super Path> filter)
|
||||
|
@ -647,10 +604,6 @@ public final class Files {
|
|||
* <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs or the parent directory does not exist
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the new file.
|
||||
*/
|
||||
public static Path createFile(Path path, FileAttribute<?>... attrs)
|
||||
throws IOException
|
||||
|
@ -689,10 +642,6 @@ public final class Files {
|
|||
* that name already exists <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs or the parent directory does not exist
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the new directory.
|
||||
*/
|
||||
public static Path createDirectory(Path dir, FileAttribute<?>... attrs)
|
||||
throws IOException
|
||||
|
@ -733,17 +682,6 @@ public final class Files {
|
|||
* exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* in the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked prior to attempting to create a directory and
|
||||
* its {@link SecurityManager#checkRead(String) checkRead} is
|
||||
* invoked for each parent directory that is checked. If {@code
|
||||
* dir} is not an absolute path then its {@link Path#toAbsolutePath
|
||||
* toAbsolutePath} may need to be invoked to get its absolute path.
|
||||
* This may invoke the security manager's {@link
|
||||
* SecurityManager#checkPropertyAccess(String) checkPropertyAccess}
|
||||
* method to check access to the system property {@code user.dir}
|
||||
*/
|
||||
public static Path createDirectories(Path dir, FileAttribute<?>... attrs)
|
||||
throws IOException
|
||||
|
@ -865,10 +803,6 @@ public final class Files {
|
|||
* when creating the directory
|
||||
* @throws IOException
|
||||
* if an I/O error occurs or {@code dir} does not exist
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file.
|
||||
*/
|
||||
public static Path createTempFile(Path dir,
|
||||
String prefix,
|
||||
|
@ -911,10 +845,6 @@ public final class Files {
|
|||
* @throws IOException
|
||||
* if an I/O error occurs or the temporary-file directory does not
|
||||
* exist
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file.
|
||||
*/
|
||||
public static Path createTempFile(String prefix,
|
||||
String suffix,
|
||||
|
@ -963,11 +893,6 @@ public final class Files {
|
|||
* when creating the directory
|
||||
* @throws IOException
|
||||
* if an I/O error occurs or {@code dir} does not exist
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access when creating the
|
||||
* directory.
|
||||
*/
|
||||
public static Path createTempDirectory(Path dir,
|
||||
String prefix,
|
||||
|
@ -1005,11 +930,6 @@ public final class Files {
|
|||
* @throws IOException
|
||||
* if an I/O error occurs or the temporary-file directory does not
|
||||
* exist
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access when creating the
|
||||
* directory.
|
||||
*/
|
||||
public static Path createTempDirectory(String prefix,
|
||||
FileAttribute<?>... attrs)
|
||||
|
@ -1057,11 +977,6 @@ public final class Files {
|
|||
* exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager
|
||||
* is installed, it denies {@link LinkPermission}{@code ("symbolic")}
|
||||
* or its {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method denies write access to the path of the symbolic link.
|
||||
*/
|
||||
public static Path createSymbolicLink(Path link, Path target,
|
||||
FileAttribute<?>... attrs)
|
||||
|
@ -1102,12 +1017,6 @@ public final class Files {
|
|||
* that name already exists <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager
|
||||
* is installed, it denies {@link LinkPermission}{@code ("hard")}
|
||||
* or its {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method denies write access to either the link or the
|
||||
* existing file.
|
||||
*/
|
||||
public static Path createLink(Path link, Path existing) throws IOException {
|
||||
provider(link).createLink(link, existing);
|
||||
|
@ -1144,10 +1053,6 @@ public final class Files {
|
|||
* exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkDelete(String)} method
|
||||
* is invoked to check delete access to the file
|
||||
*/
|
||||
public static void delete(Path path) throws IOException {
|
||||
provider(path).delete(path);
|
||||
|
@ -1183,10 +1088,6 @@ public final class Files {
|
|||
* exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkDelete(String)} method
|
||||
* is invoked to check delete access to the file.
|
||||
*/
|
||||
public static boolean deleteIfExists(Path path) throws IOException {
|
||||
return provider(path).deleteIfExists(path);
|
||||
|
@ -1287,14 +1188,6 @@ public final class Files {
|
|||
* <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the source file, the
|
||||
* {@link SecurityManager#checkWrite(String) checkWrite} is invoked
|
||||
* to check write access to the target file. If a symbolic link is
|
||||
* copied the security manager is invoked to check {@link
|
||||
* LinkPermission}{@code ("symbolic")}.
|
||||
*/
|
||||
public static Path copy(Path source, Path target, CopyOption... options)
|
||||
throws IOException
|
||||
|
@ -1422,11 +1315,6 @@ public final class Files {
|
|||
* the file cannot be moved as an atomic file system operation.
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to both the source and
|
||||
* target file.
|
||||
*/
|
||||
public static Path move(Path source, Path target, CopyOption... options)
|
||||
throws IOException
|
||||
|
@ -1465,10 +1353,6 @@ public final class Files {
|
|||
* is not a symbolic link <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager
|
||||
* is installed, it checks that {@code FilePermission} has been
|
||||
* granted with the "{@code readlink}" action to read the link.
|
||||
*/
|
||||
public static Path readSymbolicLink(Path link) throws IOException {
|
||||
return provider(link).readSymbolicLink(link);
|
||||
|
@ -1492,12 +1376,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file, and in
|
||||
* addition it checks
|
||||
* {@link RuntimePermission}{@code ("getFileStoreAttributes")}
|
||||
*/
|
||||
public static FileStore getFileStore(Path path) throws IOException {
|
||||
return provider(path).getFileStore(path);
|
||||
|
@ -1535,11 +1413,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to both files when the
|
||||
* two paths are not equal
|
||||
*
|
||||
* @see java.nio.file.attribute.BasicFileAttributes#fileKey
|
||||
*/
|
||||
|
@ -1591,11 +1464,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to both files when the
|
||||
* two paths are not equal
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
|
@ -1644,10 +1512,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*/
|
||||
public static boolean isHidden(Path path) throws IOException {
|
||||
return provider(path).isHidden(path);
|
||||
|
@ -1729,9 +1593,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* If a security manager is installed and it denies an unspecified
|
||||
* permission required by a file type detector implementation.
|
||||
*
|
||||
* @spec https://www.rfc-editor.org/info/rfc2045
|
||||
* RFC 2045: Multipurpose Internet Mail Extensions (MIME) Part One:
|
||||
|
@ -1850,12 +1711,6 @@ public final class Files {
|
|||
* if an attributes of the given type are not supported
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, a security manager is
|
||||
* installed, its {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file. If this
|
||||
* method is invoked to read security sensitive attributes then the
|
||||
* security manager may be invoked to check for additional permissions.
|
||||
*/
|
||||
public static <A extends BasicFileAttributes> A readAttributes(Path path,
|
||||
Class<A> type,
|
||||
|
@ -1919,12 +1774,6 @@ public final class Files {
|
|||
* type
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, its {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method denies write access to the file. If this method is invoked
|
||||
* to set security sensitive attributes then the security manager
|
||||
* may be invoked to check for additional permissions.
|
||||
*/
|
||||
public static Path setAttribute(Path path, String attribute, Object value,
|
||||
LinkOption... options)
|
||||
|
@ -1980,12 +1829,6 @@ public final class Files {
|
|||
* if the attribute name is not specified or is not recognized
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, its {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method denies read access to the file. If this method is invoked
|
||||
* to read security sensitive attributes then the security manager
|
||||
* may be invoked to check for additional permissions.
|
||||
*/
|
||||
public static Object getAttribute(Path path, String attribute,
|
||||
LinkOption... options)
|
||||
|
@ -2084,12 +1927,6 @@ public final class Files {
|
|||
* specified
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, its {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method denies read access to the file. If this method is invoked
|
||||
* to read security sensitive attributes then the security manager
|
||||
* may be invoked to check for additional permissions.
|
||||
*/
|
||||
public static Map<String,Object> readAttributes(Path path, String attributes,
|
||||
LinkOption... options)
|
||||
|
@ -2125,12 +1962,6 @@ public final class Files {
|
|||
* PosixFileAttributeView}
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, a security manager is
|
||||
* installed, and it denies
|
||||
* {@link RuntimePermission}{@code ("accessUserInformation")}
|
||||
* or its {@link SecurityManager#checkRead(String) checkRead} method
|
||||
* denies read access to the file.
|
||||
*/
|
||||
public static Set<PosixFilePermission> getPosixFilePermissions(Path path,
|
||||
LinkOption... options)
|
||||
|
@ -2163,12 +1994,6 @@ public final class Files {
|
|||
* PosixFilePermission}
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, it denies
|
||||
* {@link RuntimePermission}{@code ("accessUserInformation")}
|
||||
* or its {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method denies write access to the file.
|
||||
*/
|
||||
public static Path setPosixFilePermissions(Path path,
|
||||
Set<PosixFilePermission> perms)
|
||||
|
@ -2201,12 +2026,6 @@ public final class Files {
|
|||
* FileOwnerAttributeView}
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, it denies
|
||||
* {@link RuntimePermission}{@code ("accessUserInformation")}
|
||||
* or its {@link SecurityManager#checkRead(String) checkRead} method
|
||||
* denies read access to the file.
|
||||
*/
|
||||
public static UserPrincipal getOwner(Path path, LinkOption... options) throws IOException {
|
||||
FileOwnerAttributeView view =
|
||||
|
@ -2245,12 +2064,6 @@ public final class Files {
|
|||
* FileOwnerAttributeView}
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, it denies
|
||||
* {@link RuntimePermission}{@code ("accessUserInformation")}
|
||||
* or its {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method denies write access to the file.
|
||||
*
|
||||
* @see FileSystem#getUserPrincipalLookupService
|
||||
* @see java.nio.file.attribute.UserPrincipalLookupService
|
||||
|
@ -2280,11 +2093,6 @@ public final class Files {
|
|||
* @return {@code true} if the file is a symbolic link; {@code false} if
|
||||
* the file does not exist, is not a symbolic link, or it cannot
|
||||
* be determined if the file is a symbolic link or not.
|
||||
*
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, its {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method denies read access to the file.
|
||||
*/
|
||||
public static boolean isSymbolicLink(Path path) {
|
||||
try {
|
||||
|
@ -2319,11 +2127,6 @@ public final class Files {
|
|||
* @return {@code true} if the file is a directory; {@code false} if
|
||||
* the file does not exist, is not a directory, or it cannot
|
||||
* be determined if the file is a directory or not.
|
||||
*
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, its {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method denies read access to the file.
|
||||
*/
|
||||
public static boolean isDirectory(Path path, LinkOption... options) {
|
||||
try {
|
||||
|
@ -2358,11 +2161,6 @@ public final class Files {
|
|||
* @return {@code true} if the file is a regular file; {@code false} if
|
||||
* the file does not exist, is not a regular file, or it
|
||||
* cannot be determined if the file is a regular file or not.
|
||||
*
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, its {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method denies read access to the file.
|
||||
*/
|
||||
public static boolean isRegularFile(Path path, LinkOption... options) {
|
||||
try {
|
||||
|
@ -2395,10 +2193,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, its {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method denies read access to the file.
|
||||
*
|
||||
* @see BasicFileAttributes#lastModifiedTime
|
||||
*/
|
||||
|
@ -2434,10 +2228,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, its {@link SecurityManager#checkWrite(String)
|
||||
* checkWrite} method denies write access to the file.
|
||||
*
|
||||
* @see BasicFileAttributeView#setTimes
|
||||
*/
|
||||
|
@ -2463,10 +2253,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, its {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method denies read access to the file.
|
||||
*
|
||||
* @see BasicFileAttributes#size
|
||||
*/
|
||||
|
@ -2514,11 +2300,6 @@ public final class Files {
|
|||
* @return {@code true} if the file exists; {@code false} if the file does
|
||||
* not exist or its existence cannot be determined.
|
||||
*
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, the {@link
|
||||
* SecurityManager#checkRead(String)} is invoked to check
|
||||
* read access to the file.
|
||||
*
|
||||
* @see #notExists
|
||||
* @see FileSystemProvider#checkAccess
|
||||
*/
|
||||
|
@ -2551,11 +2332,6 @@ public final class Files {
|
|||
*
|
||||
* @return {@code true} if the file does not exist; {@code false} if the
|
||||
* file exists or its existence cannot be determined
|
||||
*
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, the {@link
|
||||
* SecurityManager#checkRead(String)} is invoked to check
|
||||
* read access to the file.
|
||||
*/
|
||||
public static boolean notExists(Path path, LinkOption... options) {
|
||||
try {
|
||||
|
@ -2609,11 +2385,6 @@ public final class Files {
|
|||
* if the file does not exist, read access would be denied because
|
||||
* the Java virtual machine has insufficient privileges, or access
|
||||
* cannot be determined
|
||||
*
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* is invoked to check read access to the file.
|
||||
*/
|
||||
public static boolean isReadable(Path path) {
|
||||
FileSystemProvider provider = provider(path);
|
||||
|
@ -2644,11 +2415,6 @@ public final class Files {
|
|||
* if the file does not exist, write access would be denied because
|
||||
* the Java virtual machine has insufficient privileges, or access
|
||||
* cannot be determined
|
||||
*
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* is invoked to check write access to the file.
|
||||
*/
|
||||
public static boolean isWritable(Path path) {
|
||||
FileSystemProvider provider = provider(path);
|
||||
|
@ -2683,11 +2449,6 @@ public final class Files {
|
|||
* if the file does not exist, execute access would be denied because
|
||||
* the Java virtual machine has insufficient privileges, or access
|
||||
* cannot be determined
|
||||
*
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkExec(String)
|
||||
* checkExec} is invoked to check execute access to the file.
|
||||
*/
|
||||
public static boolean isExecutable(Path path) {
|
||||
FileSystemProvider provider = provider(path);
|
||||
|
@ -2754,20 +2515,15 @@ public final class Files {
|
|||
*
|
||||
* <p> The {@code maxDepth} parameter is the maximum number of levels of
|
||||
* directories to visit. A value of {@code 0} means that only the starting
|
||||
* file is visited, unless denied by the security manager. A value of
|
||||
* {@link Integer#MAX_VALUE MAX_VALUE} may be used to indicate that all
|
||||
* levels should be visited. The {@code visitFile} method is invoked for all
|
||||
* files, including directories, encountered at {@code maxDepth}, unless the
|
||||
* basic file attributes cannot be read, in which case the {@code
|
||||
* file is visited. A value of {@link Integer#MAX_VALUE MAX_VALUE} may be used
|
||||
* to indicate that all levels should be visited. The {@code visitFile} method
|
||||
* is invoked for all files, including directories, encountered at {@code maxDepth},
|
||||
* unless the basic file attributes cannot be read, in which case the {@code
|
||||
* visitFileFailed} method is invoked.
|
||||
*
|
||||
* <p> If a visitor returns a result of {@code null} then {@code
|
||||
* NullPointerException} is thrown.
|
||||
*
|
||||
* <p> When a security manager is installed and it denies access to a file
|
||||
* (or directory), then it is ignored and the visitor is not invoked for
|
||||
* that file (or directory).
|
||||
*
|
||||
* @param start
|
||||
* the starting file
|
||||
* @param options
|
||||
|
@ -2781,11 +2537,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if the {@code maxDepth} parameter is negative
|
||||
* @throws SecurityException
|
||||
* If the security manager denies access to the starting file.
|
||||
* In the case of the default provider, the {@link
|
||||
* SecurityManager#checkRead(String) checkRead} method is invoked
|
||||
* to check read access to the directory.
|
||||
* @throws IOException
|
||||
* if an I/O error is thrown by a visitor method
|
||||
*/
|
||||
|
@ -2867,11 +2618,6 @@ public final class Files {
|
|||
*
|
||||
* @return the starting file
|
||||
*
|
||||
* @throws SecurityException
|
||||
* If the security manager denies access to the starting file.
|
||||
* In the case of the default provider, the {@link
|
||||
* SecurityManager#checkRead(String) checkRead} method is invoked
|
||||
* to check read access to the directory.
|
||||
* @throws IOException
|
||||
* if an I/O error is thrown by a visitor method
|
||||
*/
|
||||
|
@ -2907,10 +2653,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs opening the file
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*
|
||||
* @see #readAllLines
|
||||
*/
|
||||
|
@ -2943,10 +2685,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs opening the file
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
|
@ -2994,13 +2732,6 @@ public final class Files {
|
|||
* If a file of that name already exists and the {@link
|
||||
* StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified
|
||||
* <i>(optional specific exception)</i>
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file. The {@link
|
||||
* SecurityManager#checkDelete(String) checkDelete} method is
|
||||
* invoked to check delete access if the file is opened with the
|
||||
* {@code DELETE_ON_CLOSE} option.
|
||||
*
|
||||
* @see #write(Path,Iterable,Charset,OpenOption[])
|
||||
*/
|
||||
|
@ -3044,13 +2775,6 @@ public final class Files {
|
|||
* If a file of that name already exists and the {@link
|
||||
* StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified
|
||||
* <i>(optional specific exception)</i>
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file. The {@link
|
||||
* SecurityManager#checkDelete(String) checkDelete} method is
|
||||
* invoked to check delete access if the file is opened with the
|
||||
* {@code DELETE_ON_CLOSE} option.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
|
@ -3117,13 +2841,6 @@ public final class Files {
|
|||
* <i>(optional specific exception)</i>
|
||||
* @throws UnsupportedOperationException
|
||||
* if {@code options} contains a copy option that is not supported
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file. Where the
|
||||
* {@code REPLACE_EXISTING} option is specified, the security
|
||||
* manager's {@link SecurityManager#checkDelete(String) checkDelete}
|
||||
* method is invoked to check that an existing file can be deleted.
|
||||
*/
|
||||
public static long copy(InputStream in, Path target, CopyOption... options)
|
||||
throws IOException
|
||||
|
@ -3204,10 +2921,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs when reading or writing
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*/
|
||||
public static long copy(Path source, OutputStream out) throws IOException {
|
||||
// ensure not null before opening file
|
||||
|
@ -3283,10 +2996,6 @@ public final class Files {
|
|||
* @throws OutOfMemoryError
|
||||
* if an array of the required size cannot be allocated, for
|
||||
* example the file is larger that {@code 2GB}
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*/
|
||||
public static byte[] readAllBytes(Path path) throws IOException {
|
||||
try (SeekableByteChannel sbc = Files.newByteChannel(path);
|
||||
|
@ -3318,10 +3027,6 @@ public final class Files {
|
|||
* unmappable byte sequence is read
|
||||
* @throws OutOfMemoryError
|
||||
* if the file is extremely large, for example larger than {@code 2GB}
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*
|
||||
* @since 11
|
||||
*/
|
||||
|
@ -3356,10 +3061,6 @@ public final class Files {
|
|||
* unmappable byte sequence is read
|
||||
* @throws OutOfMemoryError
|
||||
* if the file is extremely large, for example larger than {@code 2GB}
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*
|
||||
* @since 11
|
||||
*/
|
||||
|
@ -3405,10 +3106,6 @@ public final class Files {
|
|||
* @throws IOException
|
||||
* if an I/O error occurs reading from the file or a malformed or
|
||||
* unmappable byte sequence is read
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*
|
||||
* @see #newBufferedReader
|
||||
*/
|
||||
|
@ -3446,10 +3143,6 @@ public final class Files {
|
|||
* @throws IOException
|
||||
* if an I/O error occurs reading from the file or a malformed or
|
||||
* unmappable byte sequence is read
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
|
@ -3499,13 +3192,6 @@ public final class Files {
|
|||
* If a file of that name already exists and the {@link
|
||||
* StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified
|
||||
* <i>(optional specific exception)</i>
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file. The {@link
|
||||
* SecurityManager#checkDelete(String) checkDelete} method is
|
||||
* invoked to check delete access if the file is opened with the
|
||||
* {@code DELETE_ON_CLOSE} option.
|
||||
*/
|
||||
public static Path write(Path path, byte[] bytes, OpenOption... options)
|
||||
throws IOException
|
||||
|
@ -3567,13 +3253,6 @@ public final class Files {
|
|||
* If a file of that name already exists and the {@link
|
||||
* StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified
|
||||
* <i>(optional specific exception)</i>
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file. The {@link
|
||||
* SecurityManager#checkDelete(String) checkDelete} method is
|
||||
* invoked to check delete access if the file is opened with the
|
||||
* {@code DELETE_ON_CLOSE} option.
|
||||
*/
|
||||
public static Path write(Path path, Iterable<? extends CharSequence> lines,
|
||||
Charset cs, OpenOption... options)
|
||||
|
@ -3619,13 +3298,6 @@ public final class Files {
|
|||
* text cannot be encoded as {@code UTF-8}
|
||||
* @throws UnsupportedOperationException
|
||||
* if an unsupported option is specified
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file. The {@link
|
||||
* SecurityManager#checkDelete(String) checkDelete} method is
|
||||
* invoked to check delete access if the file is opened with the
|
||||
* {@code DELETE_ON_CLOSE} option.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
|
@ -3662,13 +3334,6 @@ public final class Files {
|
|||
* text cannot be encoded using UTF-8
|
||||
* @throws UnsupportedOperationException
|
||||
* if an unsupported option is specified
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file. The {@link
|
||||
* SecurityManager#checkDelete(String) checkDelete} method is
|
||||
* invoked to check delete access if the file is opened with the
|
||||
* {@code DELETE_ON_CLOSE} option.
|
||||
*
|
||||
* @since 11
|
||||
*/
|
||||
|
@ -3714,13 +3379,6 @@ public final class Files {
|
|||
* text cannot be encoded using the specified charset
|
||||
* @throws UnsupportedOperationException
|
||||
* if an unsupported option is specified
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file. The {@link
|
||||
* SecurityManager#checkDelete(String) checkDelete} method is
|
||||
* invoked to check delete access if the file is opened with the
|
||||
* {@code DELETE_ON_CLOSE} option.
|
||||
*
|
||||
* @since 11
|
||||
*/
|
||||
|
@ -3784,10 +3442,6 @@ public final class Files {
|
|||
* a directory <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* if an I/O error occurs when opening the directory
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the directory.
|
||||
*
|
||||
* @see #newDirectoryStream(Path)
|
||||
* @since 1.8
|
||||
|
@ -3875,12 +3529,8 @@ public final class Files {
|
|||
*
|
||||
* <p> The {@code maxDepth} parameter is the maximum number of levels of
|
||||
* directories to visit. A value of {@code 0} means that only the starting
|
||||
* file is visited, unless denied by the security manager. A value of
|
||||
* {@link Integer#MAX_VALUE MAX_VALUE} may be used to indicate that all
|
||||
* levels should be visited.
|
||||
*
|
||||
* <p> When a security manager is installed and it denies access to a file
|
||||
* (or directory), then it is ignored and not included in the stream.
|
||||
* file is visited. A value of {@link Integer#MAX_VALUE MAX_VALUE} may be used
|
||||
* to indicate that all levels should be visited.
|
||||
*
|
||||
* <p> The returned stream contains references to one or more open directories.
|
||||
* The directories are closed by closing the stream.
|
||||
|
@ -3906,11 +3556,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if the {@code maxDepth} parameter is negative
|
||||
* @throws SecurityException
|
||||
* If the security manager denies access to the starting file.
|
||||
* In the case of the default provider, the {@link
|
||||
* SecurityManager#checkRead(String) checkRead} method is invoked
|
||||
* to check read access to the directory.
|
||||
* @throws IOException
|
||||
* if an I/O error is thrown when accessing the starting file.
|
||||
* @since 1.8
|
||||
|
@ -3964,11 +3609,6 @@ public final class Files {
|
|||
*
|
||||
* @return the {@link Stream} of {@link Path}
|
||||
*
|
||||
* @throws SecurityException
|
||||
* If the security manager denies access to the starting file.
|
||||
* In the case of the default provider, the {@link
|
||||
* SecurityManager#checkRead(String) checkRead} method is invoked
|
||||
* to check read access to the directory.
|
||||
* @throws IOException
|
||||
* if an I/O error is thrown when accessing the starting file.
|
||||
*
|
||||
|
@ -4022,11 +3662,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if the {@code maxDepth} parameter is negative
|
||||
* @throws SecurityException
|
||||
* If the security manager denies access to the starting file.
|
||||
* In the case of the default provider, the {@link
|
||||
* SecurityManager#checkRead(String) checkRead} method is invoked
|
||||
* to check read access to the directory.
|
||||
* @throws IOException
|
||||
* if an I/O error is thrown when accessing the starting file.
|
||||
*
|
||||
|
@ -4117,10 +3752,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs opening the file
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*
|
||||
* @see #readAllLines(Path, Charset)
|
||||
* @see #newBufferedReader(Path, Charset)
|
||||
|
@ -4222,10 +3853,6 @@ public final class Files {
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs opening the file
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager is
|
||||
* installed, the {@link SecurityManager#checkRead(String) checkRead}
|
||||
* method is invoked to check read access to the file.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue