public abstract class Console
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String |
ENV_CLASSPATH |
(package private) static java.lang.String |
ENV_PATH |
static java.lang.String |
EOL
The value of property "line.separator"
|
static java.lang.String |
FILE_SEP
The value of property "file.separator"
|
static java.lang.String |
OS_32_BIT |
static java.lang.String |
OS_64_BIT |
(package private) static java.lang.String |
OS_FAMILY_SYS_PROP |
static java.lang.String |
OS_NAME
The value of property "os.name"
|
static java.lang.String |
PATH_SEP
The value of property "path.separator"
|
Constructor and Description |
---|
Console() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.String> |
asList(java.lang.String... strings) |
Process2 |
batch(java.io.File workingDirectory,
java.util.List<java.lang.String> batchAndArgs)
subclass should override this method to provide its own implementation.
|
Process2 |
batch(java.io.File workingDirectory,
java.lang.String... batchAndArgs) |
protected static java.lang.String |
deduceOSFamily()
Deduce the 'OS family name' from the 'OS name'.
'windows' for all versions of Windows System. 'unix' for all versions of Unix, Linux System. 'mac' for all versions of Mac System. |
boolean |
deleteDirectory(java.lang.String directoryFullPath)
Delete a directory recursively by console command provided by Operating System.
|
static Console |
forOsFamily(java.lang.String osFamily) |
static Console |
get() |
static java.lang.String |
getClassPath() |
java.lang.String |
getLastCommand() |
static java.lang.String |
getOsArchitecture() |
static java.lang.String |
getOsFamilyName() |
static java.lang.String |
getPath() |
abstract java.lang.String |
getRecursiveDeleteCommand() |
static boolean |
is64BitOS() |
static boolean |
isMacOS() |
static boolean |
isUnixOS() |
static boolean |
isWindowsOS() |
static void |
main(java.lang.String[] args) |
protected java.lang.String |
quote(java.lang.String unquoted) |
Process2 |
start(java.io.File workingDirectory,
java.util.List<java.lang.String> binaryAndArgs)
This method suppose you have verified the binary can be found on you system.
|
Process2 |
start(java.io.File workingDirectory,
java.lang.String binary,
java.util.List<java.lang.String> args) |
Process2 |
start(java.util.List<java.lang.String> binaryAndArgs)
This method suppose you have verified the binary can be found on you system.
The console command will be executed in working directory of the current Java process, usually the directory named by the system property user.dir |
Process2 |
start(java.lang.String binary,
java.util.List<java.lang.String> args) |
public static final java.lang.String OS_NAME
public static final java.lang.String PATH_SEP
public static final java.lang.String EOL
public static final java.lang.String FILE_SEP
public static final java.lang.String OS_64_BIT
public static final java.lang.String OS_32_BIT
static final java.lang.String OS_FAMILY_SYS_PROP
static final java.lang.String ENV_PATH
static final java.lang.String ENV_CLASSPATH
public static Console get()
public static Console forOsFamily(java.lang.String osFamily)
protected static java.lang.String deduceOSFamily()
java.lang.IllegalStateException
- if neither can be deduced.public static java.lang.String getOsFamilyName()
OS_NAME
public static java.lang.String getOsArchitecture()
public static boolean is64BitOS()
public static boolean isWindowsOS()
public static boolean isUnixOS()
public static boolean isMacOS()
public Process2 start(java.util.List<java.lang.String> binaryAndArgs) throws java.io.IOException
user.dir
binaryAndArgs
- List of strings, including binary and arguments, it is console command.java.io.IOException
public Process2 start(java.io.File workingDirectory, java.util.List<java.lang.String> binaryAndArgs) throws java.io.IOException
workingDirectory
- The working directory where the console command will be executed.binaryAndArgs
- List of strings, including binary and arguments, it is console command.java.io.IOException
public java.lang.String getLastCommand()
public Process2 start(java.lang.String binary, java.util.List<java.lang.String> args) throws java.io.IOException
java.io.IOException
public Process2 start(java.io.File workingDirectory, java.lang.String binary, java.util.List<java.lang.String> args) throws java.io.IOException
java.io.IOException
public Process2 batch(java.io.File workingDirectory, java.util.List<java.lang.String> batchAndArgs) throws java.io.IOException
workingDirectory
- batchAndArgs
- java.io.IOException
public Process2 batch(java.io.File workingDirectory, java.lang.String... batchAndArgs) throws java.io.IOException
java.io.IOException
public static java.util.List<java.lang.String> asList(java.lang.String... strings)
public boolean deleteDirectory(java.lang.String directoryFullPath)
directoryFullPath,
- String, the full path of the directory to deletepublic static java.lang.String getPath()
public static java.lang.String getClassPath()
public abstract java.lang.String getRecursiveDeleteCommand()
deleteDirectory(String)
protected java.lang.String quote(java.lang.String unquoted)
public static void main(java.lang.String[] args)
Copyright © SAS Institute. All Rights Reserved.