Package ca.cgjennings.platform
Class PlatformFileSystem
- java.lang.Object
-
- ca.cgjennings.platform.PlatformFileSystem
-
public class PlatformFileSystem extends java.lang.Object
Basic platform-specific file system operations.- Author:
- Chris Jennings
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.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.static boolean
setHidden(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:
true
if 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:
true
if 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:
true
if change was successful- Throws:
java.lang.NullPointerException
- if the file isnull
-
-