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
Constructors -
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".intHow many CPU's/Core reported.longgetPid()Provides the current process id of this running application.Get name of temporary directory.Get the users home directory.booleanisDirectoryReadable(File directory) booleanisDirectoryReadable(String directoryName) booleanisDirectoryWritable(File directory) booleanisDirectoryWritable(String directoryName) booleanisFileReadable(File file) booleanisFileReadable(String fileName) booleanIs this configured to be in stub mode.voidmakeDirectoryIfNotExists(File directory) Create directory if it does not exist or exception if failed.makeSubDirectoryIfNotExists(File directory, String subDirectory) 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. -
makeSubDirectoryIfNotExists
-
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
-
isFileReadable
-
isFileReadable
-
getFileContent
-
isDirectoryReadable
-
isDirectoryReadable
-
isDirectoryWritable
-
isDirectoryWritable
-
getFilesFromDirectories
Get List of all the files in a set of directories with a particular suffix. -
getDirectoriesInDirectory
-
getFilesRecursivelyFrom
-
getFilesRecursivelyFrom
-
getFilesFromDirectory
Get all files in a directory with a specific suffix. -
getAllSubdirectories
Get all subdirectories from a root directory.
-