Package io.github.astrapi69.file.system
Class SystemFileExtensions
- java.lang.Object
-
- io.github.astrapi69.file.system.SystemFileExtensions
-
public final class SystemFileExtensions extends java.lang.Object
The classSystemFileExtensions
provide methods for get system or user files.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_USER_CONFIGURATION_DIRECTORY_NAME
Constant for the default configuration directory from the current user. current value:".config"static java.lang.String
DEFAULT_USER_DOWNLOAD_DIRECTORY_NAME
Constant for the default download directory from the current user. current value:"Downloads"
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.File
getJavaHomeDir()
Gets the installation directory for Java Runtime Environment (JRE) from the system asFile
objectstatic java.io.File
getRootDir()
Gets the root directory from the system asFile
objectstatic java.io.File
getTempDir()
Gets the temporary directory from the system as File object.static java.io.File
getUserConfigurationDir()
Gets the users configuration directory from the system asFile
objectstatic java.io.File
getUserConfigurationDir(java.lang.String configurationDirname)
Gets the users configuration directory from the system asFile
objectstatic java.io.File
getUserDownloadsDir()
Gets the users downloads directory from the system asFile
objectstatic java.io.File
getUserDownloadsDir(java.lang.String downloadsDirname)
Gets the users downloads directory from the system asFile
objectstatic java.io.File
getUserHomeDir()
Gets the user home directory from the system asFile
objectstatic java.io.File
getUserWorkingDir()
Gets the user working directory from the system asFile
objectstatic java.util.Optional<java.io.File>
getWindowsRootDriveDir(char driveLetter)
Gets the drive directory from the given drive letter asOptional
ofFile
object.
-
-
-
Field Detail
-
DEFAULT_USER_CONFIGURATION_DIRECTORY_NAME
public static final java.lang.String DEFAULT_USER_CONFIGURATION_DIRECTORY_NAME
Constant for the default configuration directory from the current user. current value:".config"- See Also:
- Constant Field Values
-
DEFAULT_USER_DOWNLOAD_DIRECTORY_NAME
public static final java.lang.String DEFAULT_USER_DOWNLOAD_DIRECTORY_NAME
Constant for the default download directory from the current user. current value:"Downloads"- See Also:
- Constant Field Values
-
-
Method Detail
-
getJavaHomeDir
public static java.io.File getJavaHomeDir()
Gets the installation directory for Java Runtime Environment (JRE) from the system asFile
object- Returns:
- the installation directory for Java Runtime Environment (JRE) from the system as
File
object
-
getTempDir
public static java.io.File getTempDir()
Gets the temporary directory from the system as File object.- Returns:
- the temporary directory from the system.
-
getUserHomeDir
public static java.io.File getUserHomeDir()
Gets the user home directory from the system asFile
object- Returns:
- the user home directory from the system as
File
object
-
getUserDownloadsDir
public static java.io.File getUserDownloadsDir()
Gets the users downloads directory from the system asFile
object- Returns:
- the users downloads directory from the system as
File
object
-
getUserDownloadsDir
public static java.io.File getUserDownloadsDir(java.lang.String downloadsDirname)
Gets the users downloads directory from the system asFile
object- Parameters:
downloadsDirname
- The name of the downloads directory, if null or empty the default value 'Downloads' will be taken- Returns:
- the users downloads directory from the system as
File
object
-
getUserConfigurationDir
public static java.io.File getUserConfigurationDir(java.lang.String configurationDirname)
Gets the users configuration directory from the system asFile
object- Parameters:
configurationDirname
- The name of the configuration directory, if null or empty the default value '.config' will be taken- Returns:
- the users configuration directory from the system as
File
object
-
getUserConfigurationDir
public static java.io.File getUserConfigurationDir()
Gets the users configuration directory from the system asFile
object- Returns:
- the users configuration directory from the system as
File
object
-
getUserWorkingDir
public static java.io.File getUserWorkingDir()
Gets the user working directory from the system asFile
object- Returns:
- the user working directory from the system as
File
object
-
getRootDir
public static java.io.File getRootDir()
Gets the root directory from the system asFile
object- Returns:
- the root directory from the system as
File
object
-
getWindowsRootDriveDir
public static java.util.Optional<java.io.File> getWindowsRootDriveDir(char driveLetter)
Gets the drive directory from the given drive letter asOptional
ofFile
object. If not found an emptyOptional
will be returned- Parameters:
driveLetter
- the drive letter- Returns:
- the drive directory from the given drive letter as
File
object or an emptyOptional
if not found
-
-