Class FileAttributes
- java.lang.Object
-
- org.codehaus.plexus.components.io.attributes.FileAttributes
-
- All Implemented Interfaces:
PlexusIoResourceAttributes
- Direct Known Subclasses:
UserGroupModeFileAttributes
public class FileAttributes extends Object implements PlexusIoResourceAttributes
-
-
Field Summary
Fields Modifier and Type Field Description static LinkOption[]FOLLOW_LINK_OPTIONSstatic LinkOption[]NOFOLLOW_LINK_OPTIONS-
Fields inherited from interface org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes
UNKNOWN_OCTAL_MODE
-
-
Constructor Summary
Constructors Constructor Description FileAttributes(File file)FileAttributes(File file, boolean followLinks)FileAttributes(File file, Map<Integer,String> userCache, Map<Integer,String> groupCache)Deprecated.useFileAttributes(File)and remove the unused userCache and groupCache parametersFileAttributes(Integer userId, String userName, Integer groupId, String groupName, int octalMode, boolean symbolicLink, boolean regularFile, boolean directory, boolean other, Set<PosixFilePermission> permissions, long size, FileTime lastModifiedTime)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcalculatePosixOctalMode()IntegergetGroupId()Gets the unix group id.StringgetGroupName()The group name.FileTimegetLastModifiedTime()intgetOctalMode()Octal mode attributes.StringgetOctalModeString()protected Set<PosixFilePermission>getPermissions()longgetSize()IntegergetUserId()Gets the unix user id.StringgetUserName()Returns the user name of the user owning the file.booleanhasGroupId()booleanhasUserId()booleanisDirectory()booleanisGroupExecutable()booleanisGroupReadable()booleanisGroupWritable()booleanisOther()booleanisOwnerExecutable()booleanisOwnerReadable()booleanisOwnerWritable()booleanisRegularFile()booleanisSymbolicLink()Indicates if this is a symbolic link element.booleanisWorldExecutable()booleanisWorldReadable()booleanisWorldWritable()StringtoString()static PlexusIoResourceAttributesuncached(File file)
-
-
-
Field Detail
-
FOLLOW_LINK_OPTIONS
public static final LinkOption[] FOLLOW_LINK_OPTIONS
-
NOFOLLOW_LINK_OPTIONS
public static final LinkOption[] NOFOLLOW_LINK_OPTIONS
-
-
Constructor Detail
-
FileAttributes
@Deprecated public FileAttributes(@Nonnull File file, @Nonnull Map<Integer,String> userCache, @Nonnull Map<Integer,String> groupCache) throws IOException
Deprecated.useFileAttributes(File)and remove the unused userCache and groupCache parameters- Throws:
IOException
-
FileAttributes
public FileAttributes(@Nonnull File file) throws IOException
- Throws:
IOException
-
FileAttributes
public FileAttributes(@Nonnull File file, boolean followLinks) throws IOException
- Throws:
IOException
-
FileAttributes
public FileAttributes(@Nullable Integer userId, String userName, @Nullable Integer groupId, @Nullable String groupName, int octalMode, boolean symbolicLink, boolean regularFile, boolean directory, boolean other, Set<PosixFilePermission> permissions, long size, FileTime lastModifiedTime)
-
-
Method Detail
-
uncached
@Nonnull public static PlexusIoResourceAttributes uncached(@Nonnull File file) throws IOException
- Throws:
IOException
-
getGroupId
@Nullable public Integer getGroupId()
Description copied from interface:PlexusIoResourceAttributesGets the unix group id.- Specified by:
getGroupIdin interfacePlexusIoResourceAttributes- Returns:
- The unix group id, may be null ("not set"), even on unix
-
hasGroupId
public boolean hasGroupId()
-
hasUserId
public boolean hasUserId()
-
getGroupName
@Nullable public String getGroupName()
Description copied from interface:PlexusIoResourceAttributesThe group name. May be null if groups are unsupported- Specified by:
getGroupNamein interfacePlexusIoResourceAttributes- Returns:
- the group names
-
getUserId
public Integer getUserId()
Description copied from interface:PlexusIoResourceAttributesGets the unix user id.- Specified by:
getUserIdin interfacePlexusIoResourceAttributes- Returns:
- The unix user id, may be null ("not set"), even on unix
-
getUserName
public String getUserName()
Description copied from interface:PlexusIoResourceAttributesReturns the user name of the user owning the file. Probably not null :)- Specified by:
getUserNamein interfacePlexusIoResourceAttributes- Returns:
- The user name
-
isGroupExecutable
public boolean isGroupExecutable()
- Specified by:
isGroupExecutablein interfacePlexusIoResourceAttributes
-
isGroupReadable
public boolean isGroupReadable()
- Specified by:
isGroupReadablein interfacePlexusIoResourceAttributes
-
isGroupWritable
public boolean isGroupWritable()
- Specified by:
isGroupWritablein interfacePlexusIoResourceAttributes
-
isOwnerExecutable
public boolean isOwnerExecutable()
- Specified by:
isOwnerExecutablein interfacePlexusIoResourceAttributes
-
isOwnerReadable
public boolean isOwnerReadable()
- Specified by:
isOwnerReadablein interfacePlexusIoResourceAttributes
-
isOwnerWritable
public boolean isOwnerWritable()
- Specified by:
isOwnerWritablein interfacePlexusIoResourceAttributes
-
isWorldExecutable
public boolean isWorldExecutable()
- Specified by:
isWorldExecutablein interfacePlexusIoResourceAttributes
-
isWorldReadable
public boolean isWorldReadable()
- Specified by:
isWorldReadablein interfacePlexusIoResourceAttributes
-
isWorldWritable
public boolean isWorldWritable()
- Specified by:
isWorldWritablein interfacePlexusIoResourceAttributes
-
getOctalMode
public int getOctalMode()
Description copied from interface:PlexusIoResourceAttributesOctal mode attributes.PlexusIoResourceAttributes.UNKNOWN_OCTAL_MODEif unsupported on current file/file system- Specified by:
getOctalModein interfacePlexusIoResourceAttributes
-
calculatePosixOctalMode
public int calculatePosixOctalMode()
-
getOctalModeString
public String getOctalModeString()
-
isSymbolicLink
public boolean isSymbolicLink()
Description copied from interface:PlexusIoResourceAttributesIndicates if this is a symbolic link element. For file-based resource attributes this value may be always "false" for versions prior to java7.- Specified by:
isSymbolicLinkin interfacePlexusIoResourceAttributes- Returns:
- True if the file is a symlink or false if not.
-
isRegularFile
public boolean isRegularFile()
-
isDirectory
public boolean isDirectory()
-
isOther
public boolean isOther()
-
getSize
public long getSize()
-
getLastModifiedTime
public FileTime getLastModifiedTime()
-
getPermissions
protected Set<PosixFilePermission> getPermissions()
-
-