Files, NativeIntegration, PosixFilespublic class DefaultPosixFiles extends AbstractFiles implements PosixFiles
| Constructor | Description |
|---|---|
DefaultPosixFiles() |
| Modifier and Type | Method | Description |
|---|---|---|
int |
getMode(File file) |
Gets the mode for the given file.
|
List<DirEntry> |
listDir(File dir) |
Lists the entries of the given directory.
|
List<DirEntry> |
listDir(File dir,
boolean linkTarget) |
Lists the entries of the given directory.
|
String |
readLink(File link) |
Reads the contents of a symbolic link.
|
void |
setMode(File file,
int perms) |
Sets the mode for the given file.
|
PosixFileInfo |
stat(File file) |
Returns basic information about the given file.
|
PosixFileInfo |
stat(File file,
boolean linkTarget) |
Returns basic information about the given file.
|
void |
symlink(File link,
String contents) |
Creates a symbolic link with given contents.
|
listDirFailurepublic PosixFileInfo stat(File file) throws NativeException
PosixFilesWhen the file references a symlink, details about the symlink is returned, not the target of the symlink.
stat in interface Filesstat in interface PosixFilesfile - The path of the file to get details of. Follows symlinks to the parent directory of this file.FileInfo.Type.Missing for a file that does not
exist.NativeException - On failure to query the file information.FilePermissionException - When the user has insufficient permissions to query the file informationpublic PosixFileInfo stat(File file, boolean linkTarget) throws NativeException
PosixFilesstat in interface Filesstat in interface PosixFilesfile - The path of the file to get details of. Follows symlinks to the parent directory of this file.linkTarget - When true and the file is a symlink, return details of the target of the symlink instead of details of the symlink itself.FileInfo.Type.Missing for a file that does not
exist.NativeException - On failure to query the file information.FilePermissionException - When the user has insufficient permissions to query the file informationpublic List<DirEntry> listDir(File dir) throws NativeException
FilesWhen a directory entry is a symlink, details about the symlink is returned, not the target of the symlink.
listDir in interface Filesdir - The path of the directory to list. Follows symlinks to this directory.NativeException - On failure.NoSuchFileException - When the specified directory does not exist.NotADirectoryException - When the specified file is not a directory.FilePermissionException - When the user has insufficient permissions to list the entriespublic List<DirEntry> listDir(File dir, boolean linkTarget) throws NativeException
FileslistDir in interface Filesdir - The path of the directory to list. Follows symlinks to this directory.linkTarget - When true and a directory entry is a symlink, return details of the target of the symlink instead of details of the symlink itself.NativeException - On failure.NoSuchFileException - When the specified directory does not exist.NotADirectoryException - When the specified file is not a directory.FilePermissionException - When the user has insufficient permissions to list the entriespublic void setMode(File file, int perms)
PosixFilessetMode in interface PosixFilespublic int getMode(File file)
PosixFilesgetMode in interface PosixFilespublic String readLink(File link) throws NativeException
PosixFilesreadLink in interface PosixFilesNativeException - On failure.public void symlink(File link, String contents) throws NativeException
PosixFilessymlink in interface PosixFilesNativeException - On failure.