mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +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
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -29,11 +29,6 @@ package java.nio.file;
|
|||
* Checked exception thrown when a file system operation is denied, typically
|
||||
* due to a file permission or other access check.
|
||||
*
|
||||
* <p> This exception is not related to the {@link
|
||||
* java.security.AccessControlException AccessControlException} or {@link
|
||||
* SecurityException} thrown by access controllers or security managers when
|
||||
* access to a file is denied.
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -172,22 +172,15 @@ public abstract class FileSystem
|
|||
*
|
||||
* <p> A file system provides access to a file store that may be composed
|
||||
* of a number of distinct file hierarchies, each with its own top-level
|
||||
* root directory. Unless denied by the security manager, each element in
|
||||
* the returned iterator corresponds to the root directory of a distinct
|
||||
* file hierarchy. The order of the elements is not defined. The file
|
||||
* hierarchies may change during the lifetime of the Java virtual machine.
|
||||
* root directory. Each element in the returned iterator corresponds to the
|
||||
* root directory of a distinct file hierarchy. The order of the elements is
|
||||
* not defined. The file hierarchies may change during the lifetime of the
|
||||
* ava virtual machine.
|
||||
* For example, in some implementations, the insertion of removable media
|
||||
* may result in the creation of a new file hierarchy with its own
|
||||
* top-level directory. There is no guarantee that a root directory
|
||||
* can be accessed.
|
||||
*
|
||||
* <p> When a security manager is installed, it is invoked to check access
|
||||
* to the each root directory. If denied, the root directory is not returned
|
||||
* by the iterator. In the case of the default provider, the {@link
|
||||
* SecurityManager#checkRead(String)} method is invoked to check read access
|
||||
* to each root directory. It is system dependent if the permission checks
|
||||
* are done when the iterator is obtained or during iteration.
|
||||
*
|
||||
* @return An object to iterate over the root directories
|
||||
*/
|
||||
public abstract Iterable<Path> getRootDirectories();
|
||||
|
@ -201,16 +194,6 @@ public abstract class FileSystem
|
|||
* Java virtual machine. When an I/O error occurs, perhaps because a file
|
||||
* store is not accessible, then it is not returned by the iterator.
|
||||
*
|
||||
* <p> In the case of the default provider, and a security manager is
|
||||
* installed, the security manager is invoked to check {@link
|
||||
* RuntimePermission}{@code ("getFileStoreAttributes")}. If denied, then
|
||||
* no file stores are returned by the iterator. In addition, the security
|
||||
* manager's {@link SecurityManager#checkRead(String)} method is invoked to
|
||||
* check read access to the file store's <em>top-most</em> directory. If
|
||||
* denied, the file store is not returned by the iterator. It is system
|
||||
* dependent if the permission checks are done when the iterator is obtained
|
||||
* or during iteration.
|
||||
*
|
||||
* <p> <b>Usage Example:</b>
|
||||
* Suppose we want to print the space usage for all file stores:
|
||||
* {@snippet lang=java :
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -206,11 +206,6 @@ public final class FileSystems {
|
|||
* exception if invoked after the file system is closed (and before a new
|
||||
* instance is created by the {@link #newFileSystem newFileSystem} method).
|
||||
*
|
||||
* <p> If a security manager is installed then a provider implementation
|
||||
* may require to check a permission before returning a reference to an
|
||||
* existing file system. In the case of the {@link FileSystems#getDefault
|
||||
* default} file system, no permission check is required.
|
||||
*
|
||||
* @param uri the URI to locate the file system
|
||||
*
|
||||
* @return the reference to the file system
|
||||
|
@ -221,9 +216,6 @@ public final class FileSystems {
|
|||
* if the file system, identified by the URI, does not exist
|
||||
* @throws ProviderNotFoundException
|
||||
* if a provider supporting the URI scheme is not installed
|
||||
* @throws SecurityException
|
||||
* if a security manager is installed and it denies an unspecified
|
||||
* permission
|
||||
*/
|
||||
public static FileSystem getFileSystem(URI uri) {
|
||||
String scheme = uri.getScheme();
|
||||
|
@ -278,9 +270,6 @@ public final class FileSystems {
|
|||
* if a provider supporting the URI scheme is not installed
|
||||
* @throws IOException
|
||||
* if an I/O error occurs creating the file system
|
||||
* @throws SecurityException
|
||||
* if a security manager is installed and it denies an unspecified
|
||||
* permission required by the file system provider implementation
|
||||
*/
|
||||
public static FileSystem newFileSystem(URI uri, Map<String,?> env)
|
||||
throws IOException
|
||||
|
@ -323,9 +312,6 @@ public final class FileSystems {
|
|||
* when an error occurs while loading a service provider
|
||||
* @throws IOException
|
||||
* an I/O error occurs creating the file system
|
||||
* @throws SecurityException
|
||||
* if a security manager is installed and it denies an unspecified
|
||||
* permission required by the file system provider implementation
|
||||
*/
|
||||
public static FileSystem newFileSystem(URI uri, Map<String,?> env, ClassLoader loader)
|
||||
throws IOException
|
||||
|
@ -389,9 +375,6 @@ public final class FileSystems {
|
|||
* when an error occurs while loading a service provider
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* if a security manager is installed and it denies an unspecified
|
||||
* permission
|
||||
*/
|
||||
public static FileSystem newFileSystem(Path path,
|
||||
ClassLoader loader)
|
||||
|
@ -428,9 +411,6 @@ public final class FileSystems {
|
|||
* when an error occurs while loading a service provider
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* if a security manager is installed and it denies an unspecified
|
||||
* permission
|
||||
*
|
||||
* @since 13
|
||||
*/
|
||||
|
@ -465,9 +445,6 @@ public final class FileSystems {
|
|||
* when an error occurs while loading a service provider
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* if a security manager is installed and it denies an unspecified
|
||||
* permission
|
||||
*
|
||||
* @since 13
|
||||
*/
|
||||
|
@ -510,9 +487,6 @@ public final class FileSystems {
|
|||
* when an error occurs while loading a service provider
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* if a security manager is installed and it denies an unspecified
|
||||
* permission
|
||||
*
|
||||
* @since 13
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -30,41 +30,11 @@ import java.security.BasicPermission;
|
|||
/**
|
||||
* The {@code Permission} class for link creation operations.
|
||||
*
|
||||
* <p> The following table provides a summary description of what the permission
|
||||
* allows, and discusses the risks of granting code the permission.
|
||||
*
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">Table shows permission target name, what the permission allows, and associated risks</caption>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th scope="col">Permission Target Name</th>
|
||||
* <th scope="col">What the Permission Allows</th>
|
||||
* <th scope="col">Risks of Allowing this Permission</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr>
|
||||
* <th scope="row">hard</th>
|
||||
* <td> Ability to add an existing file to a directory. This is sometimes
|
||||
* known as creating a link, or hard link. </td>
|
||||
* <td> Extreme care should be taken when granting this permission. It allows
|
||||
* linking to any file or directory in the file system thus allowing the
|
||||
* attacker access to all files. </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th scope="row">symbolic</th>
|
||||
* <td> Ability to create symbolic links. </td>
|
||||
* <td> Extreme care should be taken when granting this permission. It allows
|
||||
* linking to any file or directory in the file system thus allowing the
|
||||
* attacker to access to all files. </td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @apiNote
|
||||
* This permission cannot be used for controlling access to resources
|
||||
* as the Security Manager is no longer supported.
|
||||
*
|
||||
* @since 1.7
|
||||
*
|
||||
* @see Files#createLink
|
||||
* @see Files#createSymbolicLink
|
||||
*/
|
||||
public final class LinkPermission extends BasicPermission {
|
||||
@java.io.Serial
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -188,9 +188,6 @@ public interface Path
|
|||
* The file system, identified by the URI, does not exist and
|
||||
* cannot be created automatically, or the provider identified by
|
||||
* the URI's scheme component is not installed
|
||||
* @throws SecurityException
|
||||
* if a security manager is installed and it denies an unspecified
|
||||
* permission to access the file system
|
||||
*
|
||||
* @since 11
|
||||
*/
|
||||
|
@ -747,11 +744,6 @@ public interface Path
|
|||
* file system is constructed to access the contents of a file as
|
||||
* a file system, and the URI of the enclosing file system cannot be
|
||||
* obtained
|
||||
*
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, and a security manager
|
||||
* is installed, the {@link #toAbsolutePath toAbsolutePath} method
|
||||
* throws a security exception.
|
||||
*/
|
||||
URI toUri();
|
||||
|
||||
|
@ -769,12 +761,6 @@ public interface Path
|
|||
*
|
||||
* @throws java.io.IOError
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, a security manager
|
||||
* is installed, and this path is not absolute, then the security
|
||||
* manager's {@link SecurityManager#checkPropertyAccess(String)
|
||||
* checkPropertyAccess} method is invoked to check access to the
|
||||
* system property {@code user.dir}
|
||||
*/
|
||||
Path toAbsolutePath();
|
||||
|
||||
|
@ -814,13 +800,6 @@ public interface Path
|
|||
*
|
||||
* @throws IOException
|
||||
* if the file does not exist or 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 is invoked to check read access to the file, and where
|
||||
* this path is not absolute, its {@link SecurityManager#checkPropertyAccess(String)
|
||||
* checkPropertyAccess} method is invoked to check access to the
|
||||
* system property {@code user.dir}
|
||||
*/
|
||||
Path toRealPath(LinkOption... options) throws IOException;
|
||||
|
||||
|
@ -913,10 +892,6 @@ public interface Path
|
|||
* and the file is not 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 file.
|
||||
*/
|
||||
@Override
|
||||
WatchKey register(WatchService watcher,
|
||||
|
@ -969,10 +944,6 @@ public interface Path
|
|||
* and the file is not 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 file.
|
||||
*/
|
||||
@Override
|
||||
default WatchKey register(WatchService watcher,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -88,9 +88,6 @@ public final class Paths {
|
|||
* The file system, identified by the URI, does not exist and
|
||||
* cannot be created automatically, or the provider identified by
|
||||
* the URI's scheme component is not installed
|
||||
* @throws SecurityException
|
||||
* if a security manager is installed and it denies an unspecified
|
||||
* permission to access the file system
|
||||
*
|
||||
* @see Path#of(URI)
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -47,11 +47,6 @@ import java.io.IOException;
|
|||
* newDirectoryStream} method will be a {@code SecureDirectoryStream} and must
|
||||
* be cast to that type in order to invoke the methods defined by this interface.
|
||||
*
|
||||
* <p> In the case of the default {@link java.nio.file.spi.FileSystemProvider
|
||||
* provider}, and a security manager is set, then the permission checks are
|
||||
* performed using the path obtained by resolving the given relative path
|
||||
* against the <i>original path</i> of the directory (irrespective of if the
|
||||
* directory is moved since it was opened).
|
||||
* @param <T> The type of element returned by the iterator
|
||||
*
|
||||
* @since 1.7
|
||||
|
@ -90,10 +85,6 @@ public interface SecureDirectoryStream<T>
|
|||
* 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.
|
||||
*/
|
||||
SecureDirectoryStream<T> newDirectoryStream(T path, LinkOption... options)
|
||||
throws IOException;
|
||||
|
@ -138,13 +129,6 @@ public interface SecureDirectoryStream<T>
|
|||
* <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 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.
|
||||
*/
|
||||
SeekableByteChannel newByteChannel(T path,
|
||||
Set<? extends OpenOption> options,
|
||||
|
@ -171,10 +155,6 @@ public interface SecureDirectoryStream<T>
|
|||
* if the file does not exist <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#checkDelete(String) checkDelete}
|
||||
* method is invoked to check delete access to the file
|
||||
*/
|
||||
void deleteFile(T path) throws IOException;
|
||||
|
||||
|
@ -199,10 +179,6 @@ public interface SecureDirectoryStream<T>
|
|||
* not empty <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#checkDelete(String) checkDelete}
|
||||
* method is invoked to check delete access to the directory
|
||||
*/
|
||||
void deleteDirectory(T path) throws IOException;
|
||||
|
||||
|
@ -238,11 +214,6 @@ public interface SecureDirectoryStream<T>
|
|||
* if 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.
|
||||
*/
|
||||
void move(T srcpath, SecureDirectoryStream<T> targetdir, T targetpath)
|
||||
throws IOException;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -81,10 +81,6 @@ public interface Watchable {
|
|||
* if the watch service is closed
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* if a security manager is installed and it denies an unspecified
|
||||
* permission required to monitor this object. Implementations of
|
||||
* this interface should specify the permission checks.
|
||||
*/
|
||||
WatchKey register(WatchService watcher,
|
||||
WatchEvent.Kind<?>[] events,
|
||||
|
@ -118,10 +114,6 @@ public interface Watchable {
|
|||
* if the watch service is closed
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* if a security manager is installed and it denies an unspecified
|
||||
* permission required to monitor this object. Implementations of
|
||||
* this interface should specify the permission checks.
|
||||
*/
|
||||
WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events)
|
||||
throws IOException;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -170,11 +170,6 @@ public interface AclFileAttributeView
|
|||
*
|
||||
* @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.
|
||||
*/
|
||||
List<AclEntry> getAcl() throws IOException;
|
||||
|
||||
|
@ -206,11 +201,6 @@ public interface AclFileAttributeView
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs or the ACL is invalid
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, 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.
|
||||
*/
|
||||
void setAcl(List<AclEntry> acl) throws IOException;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -121,10 +121,6 @@ public interface BasicFileAttributeView
|
|||
*
|
||||
* @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
|
||||
*/
|
||||
BasicFileAttributes readAttributes() throws IOException;
|
||||
|
||||
|
@ -169,10 +165,6 @@ public interface BasicFileAttributeView
|
|||
*
|
||||
* @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#checkWrite(String) checkWrite}
|
||||
* method is invoked to check write access to the file
|
||||
*
|
||||
* @see java.nio.file.Files#setLastModifiedTime
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -97,7 +97,6 @@ public interface DosFileAttributeView
|
|||
|
||||
/**
|
||||
* @throws IOException {@inheritDoc}
|
||||
* @throws SecurityException {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
DosFileAttributes readAttributes() throws IOException;
|
||||
|
@ -115,10 +114,6 @@ public interface DosFileAttributeView
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default, and a security manager is installed,
|
||||
* its {@link SecurityManager#checkWrite(String) checkWrite} method
|
||||
* is invoked to check write access to the file
|
||||
*/
|
||||
void setReadOnly(boolean value) throws IOException;
|
||||
|
||||
|
@ -135,10 +130,6 @@ public interface DosFileAttributeView
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default, and a security manager is installed,
|
||||
* its {@link SecurityManager#checkWrite(String) checkWrite} method
|
||||
* is invoked to check write access to the file
|
||||
*/
|
||||
void setHidden(boolean value) throws IOException;
|
||||
|
||||
|
@ -155,10 +146,6 @@ public interface DosFileAttributeView
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default, and a security manager is installed,
|
||||
* its {@link SecurityManager#checkWrite(String) checkWrite} method
|
||||
* is invoked to check write access to the file
|
||||
*/
|
||||
void setSystem(boolean value) throws IOException;
|
||||
|
||||
|
@ -175,10 +162,6 @@ public interface DosFileAttributeView
|
|||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default, and a security manager is installed,
|
||||
* its {@link SecurityManager#checkWrite(String) checkWrite} method
|
||||
* is invoked to check write access to the file
|
||||
*/
|
||||
void setArchive(boolean value) throws IOException;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -66,12 +66,6 @@ public interface FileOwnerAttributeView
|
|||
*
|
||||
* @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.
|
||||
*/
|
||||
UserPrincipal getOwner() throws IOException;
|
||||
|
||||
|
@ -90,12 +84,6 @@ public interface FileOwnerAttributeView
|
|||
* if an I/O error occurs, or the {@code owner} parameter is a
|
||||
* group and this implementation does not support setting the owner
|
||||
* to a group
|
||||
* @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#checkWrite(String) checkWrite} method
|
||||
* denies write access to the file.
|
||||
*/
|
||||
void setOwner(UserPrincipal owner) throws IOException;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -152,12 +152,6 @@ public interface PosixFileAttributeView
|
|||
|
||||
/**
|
||||
* @throws IOException {@inheritDoc}
|
||||
* @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.
|
||||
*/
|
||||
@Override
|
||||
PosixFileAttributes readAttributes() throws IOException;
|
||||
|
@ -173,12 +167,6 @@ public interface PosixFileAttributeView
|
|||
* PosixFilePermission}
|
||||
* @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#checkWrite(String) checkWrite}
|
||||
* method denies write access to the file.
|
||||
*/
|
||||
void setPermissions(Set<PosixFilePermission> perms) throws IOException;
|
||||
|
||||
|
@ -190,12 +178,6 @@ public interface PosixFileAttributeView
|
|||
*
|
||||
* @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.
|
||||
*/
|
||||
void setGroup(GroupPrincipal group) throws IOException;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -47,12 +47,6 @@ import java.io.IOException;
|
|||
* intended for use where the size of an attribute value is larger than {@link
|
||||
* Integer#MAX_VALUE}.
|
||||
*
|
||||
* <p> User-defined attributes may be used in some implementations to store
|
||||
* security related attributes so consequently, in the case of the default
|
||||
* provider at least, all methods that access user-defined attributes require the
|
||||
* {@code RuntimePermission("accessUserDefinedAttributes")} permission when a
|
||||
* security manager is installed.
|
||||
*
|
||||
* <p> The {@link java.nio.file.FileStore#supportsFileAttributeView
|
||||
* supportsFileAttributeView} method may be used to test if a specific {@link
|
||||
* java.nio.file.FileStore FileStore} supports the storage of user-defined
|
||||
|
@ -86,12 +80,6 @@ public interface UserDefinedFileAttributeView
|
|||
*
|
||||
* @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 ("accessUserDefinedAttributes")}
|
||||
* or its {@link SecurityManager#checkRead(String) checkRead} method
|
||||
* denies read access to the file.
|
||||
*/
|
||||
List<String> list() throws IOException;
|
||||
|
||||
|
@ -107,12 +95,6 @@ public interface UserDefinedFileAttributeView
|
|||
* If the size of the attribute is larger than {@link Integer#MAX_VALUE}
|
||||
* @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 ("accessUserDefinedAttributes")}
|
||||
* or its {@link SecurityManager#checkRead(String) checkRead} method
|
||||
* denies read access to the file.
|
||||
*/
|
||||
int size(String name) throws IOException;
|
||||
|
||||
|
@ -153,12 +135,6 @@ public interface UserDefinedFileAttributeView
|
|||
* @throws IOException
|
||||
* If an I/O error occurs or there is insufficient space in the
|
||||
* destination buffer for the attribute value
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, a security manager is
|
||||
* installed, and it denies {@link
|
||||
* RuntimePermission}{@code ("accessUserDefinedAttributes")}
|
||||
* or its {@link SecurityManager#checkRead(String) checkRead} method
|
||||
* denies read access to the file.
|
||||
*
|
||||
* @see #size
|
||||
*/
|
||||
|
@ -203,12 +179,6 @@ public interface UserDefinedFileAttributeView
|
|||
*
|
||||
* @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 ("accessUserDefinedAttributes")}
|
||||
* or its {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method denies write access to the file.
|
||||
*/
|
||||
int write(String name, ByteBuffer src) throws IOException;
|
||||
|
||||
|
@ -220,12 +190,6 @@ public interface UserDefinedFileAttributeView
|
|||
*
|
||||
* @throws IOException
|
||||
* If an I/O error occurs or the attribute does not exist
|
||||
* @throws SecurityException
|
||||
* In the case of the default provider, a security manager is
|
||||
* installed, and it denies {@link
|
||||
* RuntimePermission}{@code ("accessUserDefinedAttributes")}
|
||||
* or its {@link SecurityManager#checkWrite(String) checkWrite}
|
||||
* method denies write access to the file.
|
||||
*/
|
||||
void delete(String name) throws IOException;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -70,10 +70,6 @@ public abstract class UserPrincipalLookupService {
|
|||
* the principal does not exist
|
||||
* @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
|
||||
* {@link RuntimePermission}{@code ("lookupUserInformation")}
|
||||
*/
|
||||
public abstract UserPrincipal lookupPrincipalByName(String name)
|
||||
throws IOException;
|
||||
|
@ -96,10 +92,6 @@ public abstract class UserPrincipalLookupService {
|
|||
* the principal does not exist or is not a group
|
||||
* @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
|
||||
* {@link RuntimePermission}{@code ("lookupUserInformation")}
|
||||
*/
|
||||
public abstract GroupPrincipal lookupPrincipalByGroupName(String group)
|
||||
throws IOException;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -118,16 +118,7 @@ public abstract class FileSystemProvider {
|
|||
private static volatile List<FileSystemProvider> installedProviders;
|
||||
|
||||
// used to avoid recursive loading of installed providers
|
||||
private static boolean loadingProviders = false;
|
||||
|
||||
private static Void checkPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("fileSystemProvider"));
|
||||
return null;
|
||||
}
|
||||
private FileSystemProvider(Void ignore) { }
|
||||
private static boolean loadingProviders;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of this class.
|
||||
|
@ -136,13 +127,8 @@ public abstract class FileSystemProvider {
|
|||
* with the default provider but care needs to be taken to avoid circular
|
||||
* loading of other installed providers. If circular loading of installed
|
||||
* providers is detected then an unspecified error is thrown.
|
||||
*
|
||||
* @throws SecurityException
|
||||
* If a security manager has been installed and it denies
|
||||
* {@link RuntimePermission}{@code ("fileSystemProvider")}
|
||||
*/
|
||||
protected FileSystemProvider() {
|
||||
this(checkPermission());
|
||||
}
|
||||
|
||||
// loads all installed providers
|
||||
|
@ -256,9 +242,6 @@ public abstract class FileSystemProvider {
|
|||
* by the provider, or a property value is invalid
|
||||
* @throws IOException
|
||||
* An I/O error occurs creating the file system
|
||||
* @throws SecurityException
|
||||
* If a security manager is installed and it denies an unspecified
|
||||
* permission required by the file system provider implementation
|
||||
* @throws FileSystemAlreadyExistsException
|
||||
* If the file system has already been created
|
||||
*/
|
||||
|
@ -286,11 +269,6 @@ public abstract class FileSystemProvider {
|
|||
* closed (and before a new instance is created by the {@link #newFileSystem
|
||||
* newFileSystem} method).
|
||||
*
|
||||
* <p> If a security manager is installed then a provider implementation
|
||||
* may require to check a permission before returning a reference to an
|
||||
* existing file system. In the case of the {@link FileSystems#getDefault
|
||||
* default} file system, no permission check is required.
|
||||
*
|
||||
* @param uri
|
||||
* URI reference
|
||||
*
|
||||
|
@ -300,9 +278,6 @@ public abstract class FileSystemProvider {
|
|||
* If the pre-conditions for the {@code uri} parameter aren't met
|
||||
* @throws FileSystemNotFoundException
|
||||
* If the file system does not exist
|
||||
* @throws SecurityException
|
||||
* If a security manager is installed and it denies an unspecified
|
||||
* permission.
|
||||
*/
|
||||
public abstract FileSystem getFileSystem(URI uri);
|
||||
|
||||
|
@ -317,11 +292,6 @@ public abstract class FileSystemProvider {
|
|||
* fragment components. The resulting {@code Path} is associated with the
|
||||
* default {@link FileSystems#getDefault default} {@code FileSystem}.
|
||||
*
|
||||
* <p> If a security manager is installed then a provider implementation
|
||||
* may require to check a permission. In the case of the {@link
|
||||
* FileSystems#getDefault default} file system, no permission check is
|
||||
* required.
|
||||
*
|
||||
* @param uri
|
||||
* The URI to convert
|
||||
*
|
||||
|
@ -333,9 +303,6 @@ public abstract class FileSystemProvider {
|
|||
* @throws FileSystemNotFoundException
|
||||
* The file system, identified by the URI, does not exist and
|
||||
* cannot be created automatically
|
||||
* @throws SecurityException
|
||||
* If a security manager is installed and it denies an unspecified
|
||||
* permission.
|
||||
*/
|
||||
public abstract Path getPath(URI uri);
|
||||
|
||||
|
@ -370,9 +337,6 @@ public abstract class FileSystemProvider {
|
|||
* by the provider, or a property value is invalid
|
||||
* @throws IOException
|
||||
* If an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* If a security manager is installed and it denies an unspecified
|
||||
* permission.
|
||||
*/
|
||||
public FileSystem newFileSystem(Path path, Map<String,?> env)
|
||||
throws IOException
|
||||
|
@ -403,10 +367,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 InputStream newInputStream(Path path, OpenOption... options)
|
||||
throws IOException
|
||||
|
@ -455,13 +415,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 OutputStream newOutputStream(Path path, OpenOption... options)
|
||||
throws IOException
|
||||
|
@ -518,12 +471,6 @@ public abstract class FileSystemProvider {
|
|||
* <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* If an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default file system, the {@link
|
||||
* SecurityManager#checkRead(String)} method is invoked to check
|
||||
* read access if the file is opened for reading. The {@link
|
||||
* SecurityManager#checkWrite(String)} method is invoked to check
|
||||
* write access if the file is opened for writing
|
||||
*/
|
||||
public FileChannel newFileChannel(Path path,
|
||||
Set<? extends OpenOption> options,
|
||||
|
@ -571,12 +518,6 @@ public abstract class FileSystemProvider {
|
|||
* <i>(optional specific exception)</i>
|
||||
* @throws IOException
|
||||
* If an I/O error occurs
|
||||
* @throws SecurityException
|
||||
* In the case of the default file system, the {@link
|
||||
* SecurityManager#checkRead(String)} method is invoked to check
|
||||
* read access if the file is opened for reading. The {@link
|
||||
* SecurityManager#checkWrite(String)} method is invoked to check
|
||||
* write access if the file is opened for writing
|
||||
*/
|
||||
public AsynchronousFileChannel newAsynchronousFileChannel(Path path,
|
||||
Set<? extends OpenOption> options,
|
||||
|
@ -614,16 +555,6 @@ public abstract class FileSystemProvider {
|
|||
* <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 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.
|
||||
*/
|
||||
public abstract SeekableByteChannel newByteChannel(Path path,
|
||||
Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException;
|
||||
|
@ -647,10 +578,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 abstract DirectoryStream<Path> newDirectoryStream(Path dir,
|
||||
DirectoryStream.Filter<? super Path> filter) throws IOException;
|
||||
|
@ -673,10 +600,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 abstract void createDirectory(Path dir, FileAttribute<?>... attrs)
|
||||
throws IOException;
|
||||
|
@ -705,11 +628,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs)
|
||||
throws IOException
|
||||
|
@ -738,12 +656,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 void createLink(Path link, Path existing) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
|
@ -764,10 +676,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 abstract void delete(Path path) throws IOException;
|
||||
|
||||
|
@ -792,10 +700,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 boolean deleteIfExists(Path path) throws IOException {
|
||||
try {
|
||||
|
@ -825,10 +729,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 Path readSymbolicLink(Path link) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
|
@ -859,14 +759,6 @@ public abstract class FileSystemProvider {
|
|||
* <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 abstract void copy(Path source, Path target, CopyOption... options)
|
||||
throws IOException;
|
||||
|
@ -898,11 +790,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 abstract void move(Path source, Path target, CopyOption... options)
|
||||
throws IOException;
|
||||
|
@ -920,10 +807,6 @@ public abstract class FileSystemProvider {
|
|||
*
|
||||
* @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.
|
||||
*/
|
||||
public abstract boolean isSameFile(Path path, Path path2)
|
||||
throws IOException;
|
||||
|
@ -942,10 +825,6 @@ public abstract class FileSystemProvider {
|
|||
*
|
||||
* @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 abstract boolean isHidden(Path path) throws IOException;
|
||||
|
||||
|
@ -961,12 +840,6 @@ public abstract class FileSystemProvider {
|
|||
*
|
||||
* @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 abstract FileStore getFileStore(Path path) throws IOException;
|
||||
|
||||
|
@ -1039,14 +912,6 @@ public abstract class FileSystemProvider {
|
|||
* privileges or other reasons. <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}
|
||||
* is invoked when checking read access to the file or only the
|
||||
* existence of the file, the {@link SecurityManager#checkWrite(String)
|
||||
* checkWrite} is invoked when checking write access to the file,
|
||||
* and {@link SecurityManager#checkExec(String) checkExec} is invoked
|
||||
* when checking execute access.
|
||||
*/
|
||||
public abstract void checkAccess(Path path, AccessMode... modes)
|
||||
throws IOException;
|
||||
|
@ -1092,10 +957,6 @@ public abstract class FileSystemProvider {
|
|||
* 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
|
||||
*/
|
||||
public abstract <A extends BasicFileAttributes> A
|
||||
readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException;
|
||||
|
@ -1122,12 +983,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 abstract Map<String,Object> readAttributes(Path path, String attributes,
|
||||
LinkOption... options)
|
||||
|
@ -1158,12 +1013,6 @@ public abstract class FileSystemProvider {
|
|||
* 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 abstract void setAttribute(Path path, String attribute,
|
||||
Object value, LinkOption... options)
|
||||
|
@ -1189,11 +1038,6 @@ public abstract class FileSystemProvider {
|
|||
* @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.
|
||||
*
|
||||
* @since 20
|
||||
*/
|
||||
public boolean exists(Path path, LinkOption... options) {
|
||||
|
@ -1252,12 +1096,6 @@ public abstract class FileSystemProvider {
|
|||
* 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.
|
||||
*
|
||||
* @since 20
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -49,24 +49,10 @@ import java.io.IOException;
|
|||
|
||||
public abstract class FileTypeDetector {
|
||||
|
||||
private static Void checkPermission() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("fileTypeDetector"));
|
||||
return null;
|
||||
}
|
||||
private FileTypeDetector(Void ignore) { }
|
||||
|
||||
/**
|
||||
* Initializes a new instance of this class.
|
||||
*
|
||||
* @throws SecurityException
|
||||
* If a security manager has been installed and it denies
|
||||
* {@link RuntimePermission}{@code ("fileTypeDetector")}
|
||||
*/
|
||||
protected FileTypeDetector() {
|
||||
this(checkPermission());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,13 +78,6 @@ public abstract class FileTypeDetector {
|
|||
*
|
||||
* @throws IOException
|
||||
* An I/O error occurs
|
||||
* @throws SecurityException
|
||||
* If the implementation requires to access the file, and a
|
||||
* security manager is installed, and it denies an unspecified
|
||||
* permission required by a file system provider implementation.
|
||||
* If the file reference is associated with the default file system
|
||||
* provider then the {@link SecurityManager#checkRead(String)} method
|
||||
* is invoked to check read access to the file.
|
||||
*
|
||||
* @spec https://www.rfc-editor.org/info/rfc2045
|
||||
* RFC 2045: Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue