public interface Stat
Represents the
stat struct, which contains file attributes.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMask value for file type block device See man page of inode(7).static final intMask value for file type character device See man page of inode(7).static final intMask value for file type directory See man page of inode(7).static final intMask value for file type named pipe (FIFO) See man page of inode(7).static final intMask value for file type symbolic link See man page of inode(7).static final intBit mask for the file type bit fieldstatic final intMask value for file type regular file See man page of inode(7).static final intMask value for file type socket See man page of inode(7).static final IntPredicateblock device?static final IntPredicatecharacter device?static final IntPredicatedirectory?static final IntPredicateFIFO (named pipe)?static final IntPredicatesymbolic link?static final IntPredicateis it a regular file?static final IntPredicatesocket? -
Method Summary
Modifier and TypeMethodDescriptionaTime()Time of last access.File creation time.cTime()Time of last status change.intgetGid()Group ID of file.intgetMode()Mode of file.longgetNLink()Number of links to the file.default Set<PosixFilePermission> Parses the permission bits fromgetMode().longgetSize()File size in bytes (if file is a regular file).intgetUid()User ID of file.default booleanhasMode(int mask) Checks whether the given bits are set inmode.mTime()Time of last data modification.voidsetGid(int gid) Setgid.voidsetMode(int mode) Setmode.default voidsetModeBits(int mask) Adds the given bit tomodevoidsetNLink(short nlink) Setnlink.default voidsetPermissions(Set<PosixFilePermission> permissions) Sets the permission bits insetMode(int)voidsetSize(long size) Setsize.voidsetUid(int uid) Setuid.default voidunsetModeBits(int mask) Erases the given bit frommode
-
Field Details
-
S_IFMT
static final int S_IFMTBit mask for the file type bit field- See Also:
-
S_IFSOCK
static final int S_IFSOCKMask value for file type socket See man page of inode(7).- See Also:
-
S_IFLNK
static final int S_IFLNKMask value for file type symbolic link See man page of inode(7).- See Also:
-
S_IFREG
static final int S_IFREGMask value for file type regular file See man page of inode(7).- See Also:
-
S_IFBLK
static final int S_IFBLKMask value for file type block device See man page of inode(7).- See Also:
-
S_IFDIR
static final int S_IFDIRMask value for file type directory See man page of inode(7).- See Also:
-
S_IFCHR
static final int S_IFCHRMask value for file type character device See man page of inode(7).- See Also:
-
S_IFIFO
static final int S_IFIFOMask value for file type named pipe (FIFO) See man page of inode(7).- See Also:
-
S_ISREG
is it a regular file? -
S_ISDIR
directory? -
S_ISCHR
character device? -
S_ISBLK
block device? -
S_ISFIFO
FIFO (named pipe)? -
S_ISLNK
symbolic link? -
S_ISSOCK
socket?
-
-
Method Details
-
aTime
-
cTime
-
mTime
-
birthTime
-
setMode
-
getMode
int getMode()Mode of file.- Returns:
st_modevalue
-
setUid
-
getUid
int getUid()User ID of file.- Returns:
st_uidvalue
-
setGid
-
getGid
int getGid()Group ID of file.- Returns:
st_gidvalue
-
setNLink
-
getNLink
long getNLink()Number of links to the file.- Returns:
st_nlinkvalue
-
setSize
-
getSize
long getSize()File size in bytes (if file is a regular file).- Returns:
st_sizevalue
-
getPermissions
Parses the permission bits fromgetMode().- Returns:
- Permissions contained in mode
-
setPermissions
Sets the permission bits insetMode(int)- Parameters:
permissions- Permissions to apply
-
hasMode
default boolean hasMode(int mask) Checks whether the given bits are set inmode.- Parameters:
mask- Bits to check- Returns:
trueif all bits frommaskare set
-
setModeBits
-
unsetModeBits
default void unsetModeBits(int mask) Erases the given bit frommode- Parameters:
mask- the bits to unset
-