Package net.rubygrapefruit.platform
Interface PosixFiles
-
- All Superinterfaces:
Files,NativeIntegration
- All Known Implementing Classes:
DefaultPosixFiles
public interface PosixFiles extends Files
Functions to query and modify files on a Posix file system.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetMode(java.io.File path)Gets the mode for the given file.java.lang.StringreadLink(java.io.File link)Reads the contents of a symbolic link.voidsetMode(java.io.File path, int perms)Sets the mode for the given file.PosixFileInfostat(java.io.File path)Returns basic information about the given file.PosixFileInfostat(java.io.File file, boolean linkTarget)Returns basic information about the given file.voidsymlink(java.io.File link, java.lang.String contents)Creates a symbolic link with given contents.
-
-
-
Method Detail
-
setMode
void setMode(java.io.File path, int perms) throws NativeExceptionSets the mode for the given file.- Throws:
NativeException- On failure.
-
getMode
int getMode(java.io.File path) throws NativeExceptionGets the mode for the given file.- Throws:
NativeException- On failure.
-
symlink
void symlink(java.io.File link, java.lang.String contents) throws NativeExceptionCreates a symbolic link with given contents.- Throws:
NativeException- On failure.
-
readLink
java.lang.String readLink(java.io.File link) throws NativeExceptionReads the contents of a symbolic link.- Throws:
NativeException- On failure.
-
stat
PosixFileInfo stat(java.io.File path) 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.
- Specified by:
statin interfaceFiles- Parameters:
path- 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.Missingfor 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
PosixFileInfo stat(java.io.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.- Specified by:
statin interfaceFiles- 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.Missingfor 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
-
-