Class FileAttributes
- java.lang.Object
-
- org.codehaus.plexus.components.io.attributes.FileAttributes
-
- All Implemented Interfaces:
PlexusIoResourceAttributes
- Direct Known Subclasses:
UserGroupModeFileAttributes
public class FileAttributes extends java.lang.Object implements PlexusIoResourceAttributes
-
-
Field Summary
Fields Modifier and Type Field Description static java.nio.file.LinkOption[]
FOLLOW_LINK_OPTIONS
static java.nio.file.LinkOption[]
NOFOLLOW_LINK_OPTIONS
-
Fields inherited from interface org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes
UNKNOWN_OCTAL_MODE
-
-
Constructor Summary
Constructors Constructor Description FileAttributes(java.io.File file)
FileAttributes(java.io.File file, boolean followLinks)
FileAttributes(java.io.File file, java.util.Map<java.lang.Integer,java.lang.String> userCache, java.util.Map<java.lang.Integer,java.lang.String> groupCache)
Deprecated.useFileAttributes(File)
and remove the unused userCache and groupCache parametersFileAttributes(java.lang.Integer userId, java.lang.String userName, java.lang.Integer groupId, java.lang.String groupName, int octalMode, boolean symbolicLink, boolean regularFile, boolean directory, boolean other, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, long size, java.nio.file.attribute.FileTime lastModifiedTime)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
calculatePosixOctalMode()
java.lang.Integer
getGroupId()
Gets the unix group id.java.lang.String
getGroupName()
The group name.java.nio.file.attribute.FileTime
getLastModifiedTime()
int
getOctalMode()
Octal mode attributes.java.lang.String
getOctalModeString()
protected java.util.Set<java.nio.file.attribute.PosixFilePermission>
getPermissions()
long
getSize()
java.lang.Integer
getUserId()
Gets the unix user id.java.lang.String
getUserName()
Returns the user name of the user owning the file.boolean
hasGroupId()
boolean
hasUserId()
boolean
isDirectory()
boolean
isGroupExecutable()
boolean
isGroupReadable()
boolean
isGroupWritable()
boolean
isOther()
boolean
isOwnerExecutable()
boolean
isOwnerReadable()
boolean
isOwnerWritable()
boolean
isRegularFile()
boolean
isSymbolicLink()
Indicates if this is a symbolic link element.boolean
isWorldExecutable()
boolean
isWorldReadable()
boolean
isWorldWritable()
java.lang.String
toString()
static PlexusIoResourceAttributes
uncached(java.io.File file)
-
-
-
Constructor Detail
-
FileAttributes
@Deprecated public FileAttributes(@Nonnull java.io.File file, @Nonnull java.util.Map<java.lang.Integer,java.lang.String> userCache, @Nonnull java.util.Map<java.lang.Integer,java.lang.String> groupCache) throws java.io.IOException
Deprecated.useFileAttributes(File)
and remove the unused userCache and groupCache parameters- Throws:
java.io.IOException
-
FileAttributes
public FileAttributes(@Nonnull java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
FileAttributes
public FileAttributes(@Nonnull java.io.File file, boolean followLinks) throws java.io.IOException
- Throws:
java.io.IOException
-
FileAttributes
public FileAttributes(@Nullable java.lang.Integer userId, java.lang.String userName, @Nullable java.lang.Integer groupId, @Nullable java.lang.String groupName, int octalMode, boolean symbolicLink, boolean regularFile, boolean directory, boolean other, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, long size, java.nio.file.attribute.FileTime lastModifiedTime)
-
-
Method Detail
-
uncached
@Nonnull public static PlexusIoResourceAttributes uncached(@Nonnull java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
getGroupId
@Nullable public java.lang.Integer getGroupId()
Description copied from interface:PlexusIoResourceAttributes
Gets the unix group id.- Specified by:
getGroupId
in 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 java.lang.String getGroupName()
Description copied from interface:PlexusIoResourceAttributes
The group name. May be null if groups are unsupported- Specified by:
getGroupName
in interfacePlexusIoResourceAttributes
- Returns:
- the group names
-
getUserId
public java.lang.Integer getUserId()
Description copied from interface:PlexusIoResourceAttributes
Gets the unix user id.- Specified by:
getUserId
in interfacePlexusIoResourceAttributes
- Returns:
- The unix user id, may be null ("not set"), even on unix
-
getUserName
public java.lang.String getUserName()
Description copied from interface:PlexusIoResourceAttributes
Returns the user name of the user owning the file. Probably not null :)- Specified by:
getUserName
in interfacePlexusIoResourceAttributes
- Returns:
- The user name
-
isGroupExecutable
public boolean isGroupExecutable()
- Specified by:
isGroupExecutable
in interfacePlexusIoResourceAttributes
-
isGroupReadable
public boolean isGroupReadable()
- Specified by:
isGroupReadable
in interfacePlexusIoResourceAttributes
-
isGroupWritable
public boolean isGroupWritable()
- Specified by:
isGroupWritable
in interfacePlexusIoResourceAttributes
-
isOwnerExecutable
public boolean isOwnerExecutable()
- Specified by:
isOwnerExecutable
in interfacePlexusIoResourceAttributes
-
isOwnerReadable
public boolean isOwnerReadable()
- Specified by:
isOwnerReadable
in interfacePlexusIoResourceAttributes
-
isOwnerWritable
public boolean isOwnerWritable()
- Specified by:
isOwnerWritable
in interfacePlexusIoResourceAttributes
-
isWorldExecutable
public boolean isWorldExecutable()
- Specified by:
isWorldExecutable
in interfacePlexusIoResourceAttributes
-
isWorldReadable
public boolean isWorldReadable()
- Specified by:
isWorldReadable
in interfacePlexusIoResourceAttributes
-
isWorldWritable
public boolean isWorldWritable()
- Specified by:
isWorldWritable
in interfacePlexusIoResourceAttributes
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getOctalMode
public int getOctalMode()
Description copied from interface:PlexusIoResourceAttributes
Octal mode attributes.PlexusIoResourceAttributes.UNKNOWN_OCTAL_MODE
if unsupported on current file/file system- Specified by:
getOctalMode
in interfacePlexusIoResourceAttributes
-
calculatePosixOctalMode
public int calculatePosixOctalMode()
-
getOctalModeString
public java.lang.String getOctalModeString()
-
isSymbolicLink
public boolean isSymbolicLink()
Description copied from interface:PlexusIoResourceAttributes
Indicates 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:
isSymbolicLink
in 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 java.nio.file.attribute.FileTime getLastModifiedTime()
-
getPermissions
protected java.util.Set<java.nio.file.attribute.PosixFilePermission> getPermissions()
-
-