Package ca.cgjennings.platform
Class PlatformFileSystem
- java.lang.Object
-
- ca.cgjennings.platform.PlatformFileSystem
-
public class PlatformFileSystem extends java.lang.ObjectBasic platform-specific file system operations.- Author:
- Chris Jennings
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanmakeReadableByUser(java.io.File file)Attempts to modify the permissions on a file so that the current user can read the file, and list contents if the file is a directory.static booleanmakeWritableByUser(java.io.File file)Attempts to modify the permissions on a file so that the current user can read and write to the file, and list contents if the file is a directory.static booleansetHidden(java.io.File file, boolean hidden)Sets the hidden attribute of a file.
-
-
-
Method Detail
-
setHidden
public static boolean setHidden(java.io.File file, boolean hidden)Sets the hidden attribute of a file. Has no effect if the file does not exist or the platform is not Windows-based. (On UNIX family platforms, including OS X, a file is considered "hidden" if the file name starts with a period character.)- Parameters:
file- the file to modifyhidden- whether the hidden bit should be set or unset- Returns:
trueif no change was needed or the required change was successful- Throws:
java.lang.NullPointerException- if the file isnull
-
makeReadableByUser
public static boolean makeReadableByUser(java.io.File file)
Attempts to modify the permissions on a file so that the current user can read the file, and list contents if the file is a directory.- Parameters:
file- the file to make readable- Returns:
trueif change was successful- Throws:
java.lang.NullPointerException- if the file isnull
-
makeWritableByUser
public static boolean makeWritableByUser(java.io.File file)
Attempts to modify the permissions on a file so that the current user can read and write to the file, and list contents if the file is a directory.- Parameters:
file- the file to make writable- Returns:
trueif change was successful- Throws:
java.lang.NullPointerException- if the file isnull
-
-