Package org.ek9lang.core
Class OsSupport
java.lang.Object
org.ek9lang.core.OsSupport
- All Implemented Interfaces:
Serializable
Operating System support and generic stuff for directories and files.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAllSubdirectories
(String directoryRoot) Get all subdirectories from a root directory.Get current working directory for this running process.getDirectoriesInDirectory
(File inDirectory, String excludeStartingWith) Get files in a particular directory, but not if they start with a prefix.getFileContent
(File file) Load up a file into a String.getFileNameWithoutPath
(String fileNameWithPath) Extract just the final part of a file name.getFilesFromDirectories
(Collection<File> inDirectories, String fileSuffix) Get List of all the files in a set of directories with a particular suffix.getFilesFromDirectory
(File inDirectory, String fileSuffix) Get all files in a directory with a specific suffix.getFilesRecursivelyFrom
(File inDirectory) Get all files down a directory structure.getFilesRecursivelyFrom
(File inDirectory, Glob searchCondition) Search down a directory structure matching a 'Glob".int
How many CPU's/Core reported.long
getPid()
Provides the current process id of this running application.Get name of temporary directory.Get the users home directory.boolean
isDirectoryReadable
(File directory) boolean
isDirectoryReadable
(String directoryName) boolean
isDirectoryWritable
(File directory) boolean
isDirectoryWritable
(String directoryName) boolean
isFileReadable
(File file) boolean
isFileReadable
(String fileName) boolean
Is this configured to be in stub mode.void
makeDirectoryIfNotExists
(File directory) Create directory if it does not exist or exception if failed.static int
-
Constructor Details
-
OsSupport
public OsSupport() -
OsSupport
public OsSupport(boolean testStubMode) Used as and when you want to use a stub for testing. You don't always want to create or access the actual users home directory or current working directory.
-
-
Method Details
-
numberOfProcessors
public static int numberOfProcessors() -
isInStubMode
public boolean isInStubMode()Is this configured to be in stub mode. -
getPid
public long getPid()Provides the current process id of this running application. -
makeDirectoryIfNotExists
Create directory if it does not exist or exception if failed. -
getTempDirectory
Get name of temporary directory. -
getUsersHomeDirectory
Get the users home directory. -
getCurrentWorkingDirectory
Get current working directory for this running process. -
getNumberOfProcessors
public int getNumberOfProcessors()How many CPU's/Core reported. -
getFileNameWithoutPath
Extract just the final part of a file name. -
isFileReadable
-
isFileReadable
-
getFileContent
Load up a file into a String. Option empty if not possible to load. -
isDirectoryReadable
-
isDirectoryReadable
-
isDirectoryWritable
-
isDirectoryWritable
-
getFilesFromDirectories
Get List of all the files in a set of directories with a particular suffix. -
getDirectoriesInDirectory
Get files in a particular directory, but not if they start with a prefix. -
getFilesRecursivelyFrom
Search down a directory structure matching a 'Glob". -
getFilesRecursivelyFrom
Get all files down a directory structure. -
getFilesFromDirectory
Get all files in a directory with a specific suffix. -
getAllSubdirectories
Get all subdirectories from a root directory.
-