Package com.nomagic.license.utils.exec
Class CommandlineImpl
- java.lang.Object
-
- com.nomagic.license.utils.exec.CommandlineImpl
-
- All Implemented Interfaces:
Commandline
public class CommandlineImpl extends java.lang.Object implements Commandline
-
-
Field Summary
-
Fields inherited from interface com.nomagic.license.utils.exec.Commandline
DEFAULT_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description CommandlineImpl()CommandlineImpl(boolean logEnabled)CommandlineImpl(long timeout)CommandlineImpl(long timeout, boolean logEnabled)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessOutputexecute(java.lang.String cmd)Execute command lineProcessOutputexecute(java.lang.String[] cmd)Execute command lineProcessOutputexecute(java.lang.String[] cmd, java.io.File dir)Execute command lineProcessOutputexecute(java.lang.String[] cmd, java.lang.String[] environment)Execute command lineProcessOutputexecute(java.lang.String[] cmd, java.lang.String[] environment, java.io.File dir)Execute command lineProcessOutputexecute(java.lang.String cmd, java.io.File dir)Execute command lineProcessOutputexecute(java.lang.String cmd, java.lang.String[] environment)Execute command lineProcessOutputexecute(java.lang.String cmd, java.lang.String[] environment, java.io.File dir)Execute command linelonggetTimeout()booleanisLogEnabled()voidlog(java.lang.String text)Print some log information.protected voidlog(java.lang.String[] cmdarray, java.lang.String[] envp, java.io.File dir)protected voidlog(java.lang.String cmd, java.lang.String[] envp, java.io.File dir)protected ProcessOutputread(java.lang.Process process)voidsetLogEnabled(boolean logEnabled)voidsetTimeout(long timeout)
-
-
-
Method Detail
-
read
protected ProcessOutput read(java.lang.Process process) throws java.lang.InterruptedException, java.io.IOException
- Throws:
java.lang.InterruptedExceptionjava.io.IOException
-
log
public void log(java.lang.String text)
Description copied from interface:CommandlinePrint some log information.- Specified by:
login interfaceCommandline
-
log
protected void log(java.lang.String cmd, java.lang.String[] envp, java.io.File dir)
-
log
protected void log(java.lang.String[] cmdarray, java.lang.String[] envp, java.io.File dir)
-
execute
public ProcessOutput execute(java.lang.String cmd, java.lang.String[] environment, java.io.File dir) throws java.io.IOException, java.lang.InterruptedException
Execute command line- Specified by:
executein interfaceCommandline- Parameters:
dir- file working directorycmd- command line- Returns:
- output of command
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
execute
public ProcessOutput execute(java.lang.String cmd, java.lang.String[] environment) throws java.io.IOException, java.lang.InterruptedException
Execute command line- Specified by:
executein interfaceCommandline- Parameters:
cmd- command line- Returns:
- output of command
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
execute
public ProcessOutput execute(java.lang.String cmd, java.io.File dir) throws java.io.IOException, java.lang.InterruptedException
Execute command line- Specified by:
executein interfaceCommandline- Parameters:
dir- file working directorycmd- command line- Returns:
- output of command
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
execute
public ProcessOutput execute(java.lang.String cmd) throws java.io.IOException, java.lang.InterruptedException
Execute command line- Specified by:
executein interfaceCommandline- Parameters:
cmd- command line- Returns:
- output of command
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
execute
public ProcessOutput execute(java.lang.String[] cmd, java.lang.String[] environment, java.io.File dir) throws java.io.IOException, java.lang.InterruptedException
Execute command line- Specified by:
executein interfaceCommandline- Parameters:
dir- file working directorycmd- command line- Returns:
- output of command
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
execute
public ProcessOutput execute(java.lang.String[] cmd, java.lang.String[] environment) throws java.io.IOException, java.lang.InterruptedException
Execute command line- Specified by:
executein interfaceCommandline- Parameters:
cmd- command line- Returns:
- output of command
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
execute
public ProcessOutput execute(java.lang.String[] cmd, java.io.File dir) throws java.io.IOException, java.lang.InterruptedException
Execute command line- Specified by:
executein interfaceCommandline- Parameters:
dir- file working directorycmd- command line- Returns:
- output of command
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
execute
public ProcessOutput execute(java.lang.String[] cmd) throws java.io.IOException, java.lang.InterruptedException
Execute command line- Specified by:
executein interfaceCommandline- Parameters:
cmd- command line- Returns:
- output of command
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
getTimeout
public long getTimeout()
- Specified by:
getTimeoutin interfaceCommandline- Returns:
-
setTimeout
public void setTimeout(long timeout)
- Specified by:
setTimeoutin interfaceCommandline
-
isLogEnabled
public boolean isLogEnabled()
- Specified by:
isLogEnabledin interfaceCommandline- Returns:
-
setLogEnabled
public void setLogEnabled(boolean logEnabled)
-
-