Package org.apache.tools.ant.util
Class PermissionUtils
- java.lang.Object
- 
- org.apache.tools.ant.util.PermissionUtils
 
- 
 public class PermissionUtils extends java.lang.ObjectContains helper methods for dealing withPosixFilePermissionor the traditional Unix mode representation of permissions.- Since:
- Ant 1.10.0
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classPermissionUtils.FileTypeThe supported types of files, maps to theisFoomethods inBasicFileAttributes.
 - 
Method SummaryModifier and Type Method Description static java.util.Set<java.nio.file.attribute.PosixFilePermission>getPermissions(Resource r, java.util.function.Function<java.nio.file.Path,java.util.Set<java.nio.file.attribute.PosixFilePermission>> posixNotSupportedFallback)Sets permissions of aResource- returns an empty set for unsupported resource types or file systems that don't support PosixFilePermissions and no fallback has been provided..static intmodeFromPermissions(java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, PermissionUtils.FileType type)Translates a set of permissions into a Unix stat(2)st_moderesult.static java.util.Set<java.nio.file.attribute.PosixFilePermission>permissionsFromMode(int mode)Translates a Unix stat(2)st_modecompatible value into a set of permissions.static voidsetPermissions(Resource r, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, java.util.function.Consumer<java.nio.file.Path> posixNotSupportedCallback)Sets permissions on aResource- doesn't do anything for unsupported resource types.
 
- 
- 
- 
Method Detail- 
modeFromPermissionspublic static int modeFromPermissions(java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, PermissionUtils.FileType type)Translates a set of permissions into a Unix stat(2)st_moderesult.- Parameters:
- permissions- the permissions
- type- the file type
- Returns:
- the "mode"
 
 - 
permissionsFromModepublic static java.util.Set<java.nio.file.attribute.PosixFilePermission> permissionsFromMode(int mode) Translates a Unix stat(2)st_modecompatible value into a set of permissions.- Parameters:
- mode- the "mode"
- Returns:
- set of permissions
 
 - 
setPermissionspublic static void setPermissions(Resource r, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, java.util.function.Consumer<java.nio.file.Path> posixNotSupportedCallback) throws java.io.IOException Sets permissions on aResource- doesn't do anything for unsupported resource types.Supported types are: - Parameters:
- r- the resource to set permissions for
- permissions- the permissions
- posixNotSupportedCallback- optional callback that is invoked for a file provider resource if the file-system holding the file doesn't support PosixFilePermissions. The Path corresponding to the file is passed to the callback.
- Throws:
- java.io.IOException- if something goes wrong
 
 - 
getPermissionspublic static java.util.Set<java.nio.file.attribute.PosixFilePermission> getPermissions(Resource r, java.util.function.Function<java.nio.file.Path,java.util.Set<java.nio.file.attribute.PosixFilePermission>> posixNotSupportedFallback) throws java.io.IOException Sets permissions of aResource- returns an empty set for unsupported resource types or file systems that don't support PosixFilePermissions and no fallback has been provided..Supported types are: - Parameters:
- r- the resource to read permissions from
- posixNotSupportedFallback- optional fallback function to provide permissions for file system that don't support PosixFilePermissions. The Path corresponding to the file is passed to the callback.
- Returns:
- the permissions
- Throws:
- java.io.IOException- if something goes wrong
 
 
- 
 
-