diff options
| author | Claes Redestad <redestad@openjdk.org> | 2020-06-08 22:47:16 +0200 |
|---|---|---|
| committer | Claes Redestad <redestad@openjdk.org> | 2020-06-08 22:47:16 +0200 |
| commit | 9cd41b65551de0ff86df473c723d97ecf4836b04 (patch) | |
| tree | d255a3d31a5f47c7194f0594534538352e19128c /src/java.base/share/classes/java/io/FileSystem.java | |
| parent | 1786701011784ba4e713d7569a3a53b10e5ce1b1 (diff) | |
| download | openjdk-9cd41b65551de0ff86df473c723d97ecf4836b04.tar.gz openjdk-9cd41b65551de0ff86df473c723d97ecf4836b04.zip | |
8246592: Simplify checking of boolean file attributes
Reviewed-by: rriggs, alanb
Diffstat (limited to 'src/java.base/share/classes/java/io/FileSystem.java')
| -rw-r--r-- | src/java.base/share/classes/java/io/FileSystem.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/java.base/share/classes/java/io/FileSystem.java b/src/java.base/share/classes/java/io/FileSystem.java index 50a890971a1..a1cea852d95 100644 --- a/src/java.base/share/classes/java/io/FileSystem.java +++ b/src/java.base/share/classes/java/io/FileSystem.java @@ -111,6 +111,15 @@ abstract class FileSystem { */ public abstract int getBooleanAttributes(File f); + /** + * Checks if all the given boolean attributes are true for the file or + * directory denoted by the given abstract pathname. False if it does not + * exist or some other I/O error occurs. + */ + public boolean hasBooleanAttributes(File f, int attributes) { + return (getBooleanAttributes(f) & attributes) == attributes; + } + @Native public static final int ACCESS_READ = 0x04; @Native public static final int ACCESS_WRITE = 0x02; @Native public static final int ACCESS_EXECUTE = 0x01; |
