Class DefaultPosixFiles
- java.lang.Object
-
- net.rubygrapefruit.platform.internal.AbstractFiles
-
- net.rubygrapefruit.platform.internal.DefaultPosixFiles
-
- All Implemented Interfaces:
Files,NativeIntegration,PosixFiles
public class DefaultPosixFiles extends AbstractFiles implements PosixFiles
-
-
Constructor Summary
Constructors Constructor Description DefaultPosixFiles()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMode(java.io.File file)Gets the mode for the given file.java.util.List<DirEntry>listDir(java.io.File dir)Lists the entries of the given directory.java.util.List<DirEntry>listDir(java.io.File dir, boolean linkTarget)Lists the entries of the given directory.java.lang.StringreadLink(java.io.File link)Reads the contents of a symbolic link.voidsetMode(java.io.File file, int perms)Sets the mode for the given file.PosixFileInfostat(java.io.File file)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.-
Methods inherited from class net.rubygrapefruit.platform.internal.AbstractFiles
listDirFailure
-
-
-
-
Method Detail
-
stat
public PosixFileInfo stat(java.io.File file) throws NativeException
Description copied from interface:PosixFilesReturns 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- Specified by:
statin interfacePosixFiles- 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.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
public PosixFileInfo stat(java.io.File file, boolean linkTarget) throws NativeException
Description copied from interface:PosixFilesReturns 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- Specified by:
statin interfacePosixFiles- 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
-
listDir
public java.util.List<DirEntry> listDir(java.io.File dir) throws NativeException
Description copied from interface:FilesLists 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.
- Specified by:
listDirin interfaceFiles- 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
public java.util.List<DirEntry> listDir(java.io.File dir, boolean linkTarget) throws NativeException
Description copied from interface:FilesLists the entries of the given directory.- Specified by:
listDirin interfaceFiles- 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
-
setMode
public void setMode(java.io.File file, int perms)Description copied from interface:PosixFilesSets the mode for the given file.- Specified by:
setModein interfacePosixFiles
-
getMode
public int getMode(java.io.File file)
Description copied from interface:PosixFilesGets the mode for the given file.- Specified by:
getModein interfacePosixFiles
-
readLink
public java.lang.String readLink(java.io.File link) throws NativeExceptionDescription copied from interface:PosixFilesReads the contents of a symbolic link.- Specified by:
readLinkin interfacePosixFiles- Throws:
NativeException- On failure.
-
symlink
public void symlink(java.io.File link, java.lang.String contents) throws NativeExceptionDescription copied from interface:PosixFilesCreates a symbolic link with given contents.- Specified by:
symlinkin interfacePosixFiles- Throws:
NativeException- On failure.
-
-