Note: The JVM must be in a single-byte locale, such as "C", "POSIX", or "en_US". PosixFile makes this assumption in its JNI implementation.
- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe set of supported crypt algorithms.static classTODO: Java 1.8: Can do this in a pure Java way. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longGroup execute permissions.static final longGroup read permissions.static final longGroup write permissions.static final longIs a block device.static final longIs a character special device.static final longIs a directory.static final longIs a FIFO.static final longIs a regular file.static final longIs a socket.static final longIs a symbolic link.static final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longWorld execute permissions.static final longWorld read permission.static final longWorld write permissions.protected final StringThe path.static final longThe mode mask for just the file permissions.static final intThe GID of the root user.static final intThe UID of the root user.static final longSave text image.static final longSet GID on execute.static final longSet UID on execute.static final longThe mode mask for just the file type.static final longOwner execute permissions.static final longOwner read permissions.static final longOwner write permissions. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Please call #PosixFile(PosixFile,String,boolean) to explicitly control whether strict parent checking is performedCreates a new POSIX file.Creates a new POSIX file.Creates a new POSIX file.Creates a new POSIX file.Creates a new POSIX file. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidEnsures that the calling thread is allowed to read thisPosixFilein any way.static voidEnsures that the calling thread is allowed to read thispathin any way.final voidEnsures that the calling thread is allowed to write to or modify thisPosixFilein any way.static voidcheckWrite(String path) Ensures that the calling thread is allowed to write to or modify thispathin any way.final PosixFilechown(int uid, int gid) Changes both the owner and group for a file.booleancontentEquals(byte[] otherFile) Compares the contents of a file to a byte[].booleancontentEquals(PosixFile otherFile) Compares this contents of this file to the contents of another file.voidCopies one filesystem object to another.static StringDeprecated, for removal: This API element is subject to removal in a future version.Please provide the algorithm and callcrypt(java.lang.String, com.aoapps.io.posix.PosixFile.CryptAlgorithm)instead.static Stringcrypt(String password, PosixFile.CryptAlgorithm algorithm) Hashes a password using the provided crypt algorithm and a defaultSecureRandominstance, which is not a strong instance to avoid blocking.static Stringcrypt(String password, PosixFile.CryptAlgorithm algorithm, SecureRandom secureRandom) Hashes a password using the provided crypt algorithm and the provided random source.static StringHashes a password using the provided salt.static Stringcrypt(String password, SecureRandom secureRandom) Deprecated, for removal: This API element is subject to removal in a future version.Please provide the algorithm and callcrypt(java.lang.String, com.aoapps.io.posix.PosixFile.CryptAlgorithm, java.security.SecureRandom)instead.final voiddelete()Deletes this file.final voidDeletes this file and if it is a directory, all files below it.booleanfinal booleanexists()Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).exists()final longDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getAccessTime()final longDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(State).getBlockCount()final intDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getBlockSize()final longDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getChangeTime()final longDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getDevice()final longDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getDeviceIdentifier()final StringGets the extension for this file.final FilegetFile()Gets theFilefor thisPosixFile.final StringDeprecated, for removal: This API element is subject to removal in a future version.the use of the wordfilenameis misleading since it represents the entire path, please usegetPath()instead.final intgetGid()Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getGid()final longgetInode()Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getInode()final intDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getNumberLinks()final longgetMode()Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getMode()final StringDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getModeString()static StringgetModeString(long mode) Gets a String representation of a mode similar to the output of the POSIXlscommand.final longDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getModifyTime()final PosixFileGets the parent of this file ornullif it doesn't have a parent.final StringgetPath()Gets the path for thisPosixFile.final FileInputStreamgetSecureInputStream(int uidMin, int gidMin) Securely gets aFileInputStreamto this file, temporarily performing permission changes and ensuring that no symbolic links are anywhere in the path.final FileOutputStreamgetSecureOutputStream(int uid, int gid, long mode, boolean overwrite, int uidMin, int gidMin) Securely gets aFileOutputStreamto this file, temporarily performing permission changes and ensuring that no symbolic links are anywhere in the path.final RandomAccessFilegetSecureRandomAccessFile(String mode, int uidMin, int gidMin) Securely gets aRandomAccessFileto this file, temporarily performing permission changes and ensuring that no symbolic links are anywhere in the path.final longgetSize()Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getSize()getStat()Stats the file.final longDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getRawMode()final intgetUid()Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getUid()inthashCode()final booleanDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isBlockDevice()static booleanisBlockDevice(long mode) Determines if a specific mode represents a block device.final booleanDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isCharacterDevice()static booleanisCharacterDevice(long mode) Determines if a specific mode represents a character device.final booleanDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isDirectory()static booleanisDirectory(long mode) Determines if a specific mode represents a directory.final booleanisFifo()Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isFifo()static booleanisFifo(long mode) Determines if a specific mode represents a FIFO.final booleanDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isRegularFile()static booleanisRegularFile(long mode) Determines if a specific mode represents a regular file.final booleanDetermines if this file is the root directory.final booleanisSocket()Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isSocket()static booleanisSocket(long mode) Determines if a specific mode represents a socket.final booleanDeprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isSymLink()static booleanisSymLink(long mode) Determines if a specific mode represents a symbolic link.final PosixFileCreates a hard link.final PosixFileCreates a hard link.final String[]list()Lists the contents of the directory.static voidLoads the shared library native codelibaocode.so.final PosixFilemkdir()Creates a directory.final PosixFilemkdir(boolean makeParents, long mode) Creates a directory and sets its permissions, optionally creating all the parent directories if they do not exist.final PosixFilemkdir(boolean makeParents, long mode, int uid, int gid) Creates a directory and sets its permissions, optionally creating all the parent directories if they do not exist.final PosixFilemkfifo(long mode) Creates a FIFO.final PosixFilemknod(long mode, long device) Creates a device file.static PosixFileDeprecated, for removal: This API element is subject to removal in a future version.static PosixFileDeprecated, for removal: This API element is subject to removal in a future version.Please useFiles.createTempFile(java.lang.String, java.lang.String, java.nio.file.attribute.FileAttribute...)or TempFileContext asFile.deleteOnExit()is prone to memory leaks in long-running applications.final StringreadLink()Reads a symbolic link.final voidRenames this file, possibly overwriting any previous file.final voidrestoreParents(List<PosixFile.SecuredDirectory> parentsChanged) TODO: Java 1.8: Can do this in a pure Java way.booleansecureContentEquals(byte[] otherFile, int uidMin, int gidMin) Compares the contents of a file to a byte[].booleansecureContentEquals(PosixFile otherFile, int uidMin, int gidMin) Compares this contents of this file to the contents of another file.final voidsecureDeleteRecursive(int uidMin, int gidMin) Securely deletes this file entry and all files below it while not following symbolic links.final voidsecureParents(List<PosixFile.SecuredDirectory> parentsChanged, int uidMin, int gidMin) TODO: Java 1.8: Can do this in a pure Java way.final PosixFilesetAccessTime(long atime) Deprecated.This method internally performs an extra stat.final PosixFilesetGid(int gid) Deprecated.This method internally performs an extra stat.final PosixFilesetGID(int gid) Deprecated, for removal: This API element is subject to removal in a future version.Please usesetGid(int)instead.final PosixFilesetMode(long mode) Sets the permissions for this file.final PosixFilesetModifyTime(long mtime) Deprecated.This method internally performs an extra stat.final PosixFilesetUid(int uid) Deprecated.This method internally performs an extra stat.final PosixFilesetUID(int uid) Deprecated, for removal: This API element is subject to removal in a future version.Please usesetUid(int)instead.final PosixFileCreates a symbolic link.final StringtoString()final PosixFileutime(long atime, long mtime) Sets the access and modify times for this file.
-
Field Details
-
ROOT_UID
public static final int ROOT_UIDThe UID of the root user.Note: Copied to LinuxServerAccount.java to avoid interproject dependency.
- See Also:
-
ROOT_GID
public static final int ROOT_GIDThe GID of the root user.- See Also:
-
PERMISSION_MASK
public static final long PERMISSION_MASKThe mode mask for just the file permissions.- See Also:
-
OTHER_EXECUTE
public static final long OTHER_EXECUTEWorld execute permissions.- See Also:
-
NOT_OTHER_EXECUTE
public static final long NOT_OTHER_EXECUTE- See Also:
-
OTHER_WRITE
public static final long OTHER_WRITEWorld write permissions.- See Also:
-
NOT_OTHER_WRITE
public static final long NOT_OTHER_WRITE- See Also:
-
OTHER_READ
public static final long OTHER_READWorld read permission.- See Also:
-
NOT_OTHER_READ
public static final long NOT_OTHER_READ- See Also:
-
GROUP_EXECUTE
public static final long GROUP_EXECUTEGroup execute permissions.- See Also:
-
NOT_GROUP_EXECUTE
public static final long NOT_GROUP_EXECUTE- See Also:
-
GROUP_WRITE
public static final long GROUP_WRITEGroup write permissions.- See Also:
-
NOT_GROUP_WRITE
public static final long NOT_GROUP_WRITE- See Also:
-
GROUP_READ
public static final long GROUP_READGroup read permissions.- See Also:
-
NOT_GROUP_READ
public static final long NOT_GROUP_READ- See Also:
-
USER_EXECUTE
public static final long USER_EXECUTEOwner execute permissions.- See Also:
-
NOT_USER_EXECUTE
public static final long NOT_USER_EXECUTE- See Also:
-
USER_WRITE
public static final long USER_WRITEOwner write permissions.- See Also:
-
NOT_USER_WRITE
public static final long NOT_USER_WRITE- See Also:
-
USER_READ
public static final long USER_READOwner read permissions.- See Also:
-
NOT_USER_READ
public static final long NOT_USER_READ- See Also:
-
SAVE_TEXT_IMAGE
public static final long SAVE_TEXT_IMAGESave text image.- See Also:
-
NOT_SAVE_TEXT_IMAGE
public static final long NOT_SAVE_TEXT_IMAGE- See Also:
-
SET_GID
public static final long SET_GIDSet GID on execute.- See Also:
-
NOT_SET_GID
public static final long NOT_SET_GID- See Also:
-
SET_UID
public static final long SET_UIDSet UID on execute.- See Also:
-
NOT_SET_UID
public static final long NOT_SET_UID- See Also:
-
TYPE_MASK
public static final long TYPE_MASKThe mode mask for just the file type.- See Also:
-
IS_FIFO
public static final long IS_FIFOIs a FIFO.- See Also:
-
IS_CHARACTER_DEVICE
public static final long IS_CHARACTER_DEVICEIs a character special device.- See Also:
-
IS_DIRECTORY
public static final long IS_DIRECTORYIs a directory.- See Also:
-
IS_BLOCK_DEVICE
public static final long IS_BLOCK_DEVICEIs a block device.- See Also:
-
IS_REGULAR_FILE
public static final long IS_REGULAR_FILEIs a regular file.- See Also:
-
IS_SYM_LINK
public static final long IS_SYM_LINKIs a symbolic link.- See Also:
-
IS_SOCKET
public static final long IS_SOCKETIs a socket.- See Also:
-
path
The path.
-
-
Constructor Details
-
PosixFile
Deprecated.Please call #PosixFile(PosixFile,String,boolean) to explicitly control whether strict parent checking is performedCreates a new POSIX file.Strictly requires the parent to be a directory if it exists.
- Throws:
IOException
-
PosixFile
Creates a new POSIX file.- Parameters:
strict- When strictly checking, a parent must be a directory if it exists.- Throws:
IOException
-
PosixFile
Creates a new POSIX file. -
PosixFile
Creates a new POSIX file. -
PosixFile
Creates a new POSIX file. -
PosixFile
Creates a new POSIX file.
-
-
Method Details
-
loadLibrary
public static void loadLibrary()Loads the shared library native codelibaocode.so. -
checkRead
Ensures that the calling thread is allowed to read thisPosixFilein any way.- Throws:
IOException
-
checkRead
Ensures that the calling thread is allowed to read thispathin any way.- Throws:
IOException
-
checkWrite
Ensures that the calling thread is allowed to write to or modify thisPosixFilein any way.- Throws:
IOException
-
checkWrite
Ensures that the calling thread is allowed to write to or modify thispathin any way.- Throws:
IOException
-
chown
Changes both the owner and group for a file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getStat
Stats the file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
contentEquals
Compares this contents of this file to the contents of another file.This method will follow both path symbolic links and a final symbolic link.
- Throws:
IOException
-
contentEquals
Compares the contents of a file to a byte[].This method will follow both path symbolic links and a final symbolic link.
- Throws:
IOException
-
secureContentEquals
Compares this contents of this file to the contents of another file.This method will not follow any symbolic links and is not subject to race conditions.
TODO: Java 1.8: Can do this in a pure Java way
- Throws:
IOException
-
secureContentEquals
Compares the contents of a file to a byte[].This method will not follow any symbolic links and is not subject to race conditions.
TODO: Java 1.8: Can do this in a pure Java way
- Throws:
IOException
-
copyTo
Copies one filesystem object to another. It supports block devices, directories, fifos, regular files, and symbolic links. Directories are not copied recursively.This method will follow both path symbolic links and a final symbolic link.
- Throws:
IOException
-
crypt
Hashes a password using the provided salt. The salt includes anysalt prefixfor the algorithm.Please refer to
man 3 cryptfor more details. -
crypt
public static String crypt(String password, PosixFile.CryptAlgorithm algorithm, SecureRandom secureRandom) Hashes a password using the provided crypt algorithm and the provided random source. -
crypt
Deprecated, for removal: This API element is subject to removal in a future version.Please provide the algorithm and callcrypt(java.lang.String, com.aoapps.io.posix.PosixFile.CryptAlgorithm)instead.Hashes a password using the MD5 crypt algorithm and a defaultSecureRandominstance, which is not a strong instance to avoid blocking. -
crypt
Deprecated, for removal: This API element is subject to removal in a future version.Please provide the algorithm and callcrypt(java.lang.String, com.aoapps.io.posix.PosixFile.CryptAlgorithm, java.security.SecureRandom)instead.Hashes a password using the MD5 crypt algorithm and the provided random source. -
crypt
Hashes a password using the provided crypt algorithm and a defaultSecureRandominstance, which is not a strong instance to avoid blocking. -
delete
Deletes this file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException- See Also:
-
deleteRecursive
Deletes this file and if it is a directory, all files below it.Due to a race conditition, this method will follow symbolic links. Please use
secureDeleteRecursiveinstead.- Throws:
IOException- See Also:
-
secureParents
public final void secureParents(List<PosixFile.SecuredDirectory> parentsChanged, int uidMin, int gidMin) throws IOException TODO: Java 1.8: Can do this in a pure Java way.- Throws:
IOException
-
restoreParents
public final void restoreParents(List<PosixFile.SecuredDirectory> parentsChanged) throws IOException TODO: Java 1.8: Can do this in a pure Java way.- Throws:
IOException
-
secureDeleteRecursive
Securely deletes this file entry and all files below it while not following symbolic links. This method must be called with root privileges to properly avoid race conditions. If not running with root privileges, usedeleteRecursiveinstead.In order to avoid race conditions, all directories above this directory will have their permissions set so that regular users cannot modify the directories. After each parent directory has its permissions set it will then check for symbolic links. Once all of the parent directories have been completed, the filesystem will recursively have its permissions reset, scans for symlinks, and deletes performed in such a way all race conditions are avoided. Finally, the parent directory permissions that were modified will be restored.
TODO: Java 1.8: Can do this in a pure Java way
- Throws:
IOException- See Also:
-
exists
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).exists()Determines if a file exists, a symbolic link with an invalid destination is still considered to exist.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getAccessTime
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getAccessTime()Gets the last access to this file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getBlockCount
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(State).getBlockCount()Gets the block count for this file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getBlockSize
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getBlockSize()Gets the block size for this file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getChangeTime
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getChangeTime()Gets the change time of this file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getDevice
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getDevice()Gets the device for this file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getDeviceIdentifier
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getDeviceIdentifier()Gets the device identifier for this file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getExtension
Gets the extension for this file. -
getFile
Gets theFilefor thisPosixFile. Not synchronized because multiple instantiation is acceptable. -
getFilename
Deprecated, for removal: This API element is subject to removal in a future version.the use of the wordfilenameis misleading since it represents the entire path, please usegetPath()instead.Gets the path for thisPosixFile.- See Also:
-
getPath
Gets the path for thisPosixFile. -
getGid
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getGid()Gets the group ID for this file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getInode
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getInode()Gets the inode for this file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getLinkCount
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getNumberLinks()Gets the link count for this file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getMode
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getMode()Gets the permission bits of the mode of this file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getModeString
Gets a String representation of a mode similar to the output of the POSIXlscommand. -
getModeString
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getModeString()Gets a String representation of the mode of this file similar to the output of the POSIXlscommand.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getSecureInputStream
Securely gets aFileInputStreamto this file, temporarily performing permission changes and ensuring that no symbolic links are anywhere in the path.TODO: Java 1.8: Can do this in a pure Java way
- Throws:
IOException
-
getSecureOutputStream
public final FileOutputStream getSecureOutputStream(int uid, int gid, long mode, boolean overwrite, int uidMin, int gidMin) throws IOException Securely gets aFileOutputStreamto this file, temporarily performing permission changes and ensuring that no symbolic links are anywhere in the path.TODO: Consider the impact of using mktemp instead of secureParents/restoreParents because there is the possibility that permissions may not be restored if the JVM is shutdown at that moment.
TODO: Java 1.8: Can do this in a pure Java way
- Throws:
IOException
-
getSecureRandomAccessFile
public final RandomAccessFile getSecureRandomAccessFile(String mode, int uidMin, int gidMin) throws IOException Securely gets aRandomAccessFileto this file, temporarily performing permission changes and ensuring that no symbolic links are anywhere in the path.TODO: Java 1.8: Can do this in a pure Java way
- Throws:
IOException
-
getParent
Gets the parent of this file ornullif it doesn't have a parent. Not synchronized because multiple instantiation is acceptable. -
getStatMode
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getRawMode()Gets the complete mode of the file, including the bits representing the file type.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getModifyTime
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getModifyTime()Gets the modification time of the file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getSize
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getSize()Gets the size of the file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
mktemp
Deprecated, for removal: This API element is subject to removal in a future version.Securely creates a temporary file, not deleting on exit. In order to be secure, though, the directory needs to be secure, or at least have the sticky bit set.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException- See Also:
-
mktemp
@Deprecated(forRemoval=true) public static PosixFile mktemp(String template, boolean deleteOnExit) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.Please useFiles.createTempFile(java.lang.String, java.lang.String, java.nio.file.attribute.FileAttribute...)or TempFileContext asFile.deleteOnExit()is prone to memory leaks in long-running applications.Securely creates a temporary file. In order to be secure, though, the directory needs to be secure, or at least have the sticky bit set.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
getUid
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).getUid()Gets the user ID of the file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
isBlockDevice
public static boolean isBlockDevice(long mode) Determines if a specific mode represents a block device. -
isBlockDevice
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isBlockDevice()Determines if this file represents a block device.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
isCharacterDevice
public static boolean isCharacterDevice(long mode) Determines if a specific mode represents a character device. -
isCharacterDevice
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isCharacterDevice()Determines if this file represents a character device.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
isDirectory
public static boolean isDirectory(long mode) Determines if a specific mode represents a directory. -
isDirectory
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isDirectory()Determines if this file represents a directory.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
isFifo
public static boolean isFifo(long mode) Determines if a specific mode represents a FIFO. -
isFifo
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isFifo()Determines if this file represents a FIFO.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
isRegularFile
public static boolean isRegularFile(long mode) Determines if a specific mode represents a regular file. -
isRegularFile
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isRegularFile()Determines if this file represents a regular file.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
isRootDirectory
public final boolean isRootDirectory()Determines if this file is the root directory. -
isSocket
public static boolean isSocket(long mode) Determines if a specific mode represents a socket. -
isSocket
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isSocket()Determines if this file represents a socket.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
isSymLink
public static boolean isSymLink(long mode) Determines if a specific mode represents a symbolic link. -
isSymLink
Deprecated, for removal: This API element is subject to removal in a future version.Please use getStat(Stat).isSymLink()Determines if this file represents a sybolic link.This method will follow symbolic links in the path but not a final symbolic link.
- Throws:
IOException
-
list
Lists the contents of the directory.This method will follow symbolic links in the path, including a final symbolic link.
- See Also:
-
mkdir
Creates a directory.This method will follow symbolic links in the path.
- Throws:
IOException
-
mkdir
Creates a directory and sets its permissions, optionally creating all the parent directories if they do not exist.This method will follow symbolic links in the path.
- Throws:
IOException
-
mkdir
Creates a directory and sets its permissions, optionally creating all the parent directories if they do not exist.This method will follow symbolic links in the path.
- Throws:
IOException
-
mknod
Creates a device file.This method will follow symbolic links in the path.
- Throws:
IOException
-
mkfifo
Creates a FIFO.This method will follow symbolic links in the path.
- Throws:
IOException
-
setAccessTime
Deprecated.This method internally performs an extra stat. Please try to use utime(long,long) directly to avoid this extra stat.Sets the access time for this file.This method will follow symbolic links in the path.
- Throws:
IOException
-
setGid
Deprecated.This method internally performs an extra stat. Please try to use chown(int,int) directly to avoid this extra stat.Sets the group ID for this file.This method will follow symbolic links in the path.
- Throws:
IOException
-
setGID
Deprecated, for removal: This API element is subject to removal in a future version.Please usesetGid(int)instead.Sets the group ID for this file.This method will follow symbolic links in the path.
- Throws:
IOException
-
setMode
Sets the permissions for this file.This method will follow symbolic links in the path.
- Throws:
IOException
-
setModifyTime
Deprecated.This method internally performs an extra stat. Please try to use utime(long,long) directly to avoid this extra stat.Sets the modification time for this file.This method will follow symbolic links in the path.
- Throws:
IOException
-
setUid
Deprecated.This method internally performs an extra stat. Please try to use chown(int,int) directly to avoid this extra stat.Sets the user ID for this file.This method will follow symbolic links in the path.
- Throws:
IOException
-
setUID
Deprecated, for removal: This API element is subject to removal in a future version.Please usesetUid(int)instead.Sets the user ID for this file.This method will follow symbolic links in the path.
- Throws:
IOException
-
symLink
Creates a symbolic link.This method will follow symbolic links in the path.
- Throws:
IOException
-
link
Creates a hard link.This method will follow symbolic links in the path.
- Throws:
IOException
-
link
Creates a hard link.This method will follow symbolic links in the path.
- Throws:
IOException
-
readLink
Reads a symbolic link.This method will follow symbolic links in the path.
- Throws:
IOException
-
renameTo
Renames this file, possibly overwriting any previous file.This method will follow symbolic links in the path.
- Throws:
IOException- See Also:
-
toString
-
utime
Sets the access and modify times for this file.This method will follow symbolic links in the path.
- Throws:
IOException
-
hashCode
public int hashCode() -
equals
-
