Package net.rubygrapefruit.platform
Interface Files
-
- All Superinterfaces:
NativeIntegration
- All Known Subinterfaces:
PosixFiles
,WindowsFiles
- All Known Implementing Classes:
AbstractFiles
,DefaultPosixFiles
,DefaultWindowsFiles
public interface Files extends NativeIntegration
Functions to query and modify files. There are several sub-types of this interface that allow access to platform specific file features.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<? extends DirEntry>
listDir(File dir)
Lists the entries of the given directory.List<? extends DirEntry>
listDir(File dir, boolean linkTarget)
Lists the entries of the given directory.FileInfo
stat(File file)
Returns basic information about the given file.FileInfo
stat(File file, boolean linkTarget)
Returns basic information about the given file.
-
-
-
Method Detail
-
stat
FileInfo stat(File file) throws NativeException
Returns basic information about the given file. Returns whatever file details can be efficiently calculated in a single system call, which is more efficient that querying these details separately.When the file references a symlink, details about the symlink is returned, not the target of the symlink.
- Parameters:
file
- The path of the file to get details of. Follows symlinks to the parent directory of this file.- Returns:
- Details of the file. Returns details with type
FileInfo.Type.Missing
for a file that does not exist. - Throws:
NativeException
- On failure to query the file information.FilePermissionException
- When the user has insufficient permissions to query the file information
-
stat
FileInfo stat(File file, boolean linkTarget) throws NativeException
Returns basic information about the given file. Returns whatever file details can be efficiently calculated in a single system call, which is more efficient that querying these details separately.- Parameters:
file
- 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.- Returns:
- Details of the file. Returns details with type
FileInfo.Type.Missing
for a file that does not exist. - Throws:
NativeException
- On failure to query the file information.FilePermissionException
- When the user has insufficient permissions to query the file information
-
listDir
List<? extends DirEntry> listDir(File dir) throws NativeException
Lists the entries of the given directory.When a directory entry is a symlink, details about the symlink is returned, not the target of the symlink.
- Parameters:
dir
- The path of the directory to list. Follows symlinks to this directory.- Throws:
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 entries
-
listDir
List<? extends DirEntry> listDir(File dir, boolean linkTarget) throws NativeException
Lists the entries of the given directory.- Parameters:
dir
- 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.- Throws:
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 entries
-
-