mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8246592: Simplify checking of boolean file attributes
Reviewed-by: rriggs, alanb
This commit is contained in:
parent
1786701011
commit
9cd41b6555
4 changed files with 47 additions and 9 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue