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 ProcessOutput
execute(java.lang.String cmd)
Execute command lineProcessOutput
execute(java.lang.String[] cmd)
Execute command lineProcessOutput
execute(java.lang.String[] cmd, java.io.File dir)
Execute command lineProcessOutput
execute(java.lang.String[] cmd, java.lang.String[] environment)
Execute command lineProcessOutput
execute(java.lang.String[] cmd, java.lang.String[] environment, java.io.File dir)
Execute command lineProcessOutput
execute(java.lang.String cmd, java.io.File dir)
Execute command lineProcessOutput
execute(java.lang.String cmd, java.lang.String[] environment)
Execute command lineProcessOutput
execute(java.lang.String cmd, java.lang.String[] environment, java.io.File dir)
Execute command linelong
getTimeout()
boolean
isLogEnabled()
void
log(java.lang.String text)
Print some log information.protected void
log(java.lang.String[] cmdarray, java.lang.String[] envp, java.io.File dir)
protected void
log(java.lang.String cmd, java.lang.String[] envp, java.io.File dir)
protected ProcessOutput
read(java.lang.Process process)
void
setLogEnabled(boolean logEnabled)
void
setTimeout(long timeout)
-
-
-
Method Detail
-
read
protected ProcessOutput read(java.lang.Process process) throws java.lang.InterruptedException, java.io.IOException
- Throws:
java.lang.InterruptedException
java.io.IOException
-
log
public void log(java.lang.String text)
Description copied from interface:Commandline
Print some log information.- Specified by:
log
in 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:
execute
in interfaceCommandline
- Parameters:
dir
- file working directorycmd
- command line- Returns:
- output of command
- Throws:
java.io.IOException
java.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:
execute
in interfaceCommandline
- Parameters:
cmd
- command line- Returns:
- output of command
- Throws:
java.io.IOException
java.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:
execute
in interfaceCommandline
- Parameters:
dir
- file working directorycmd
- command line- Returns:
- output of command
- Throws:
java.io.IOException
java.lang.InterruptedException
-
execute
public ProcessOutput execute(java.lang.String cmd) throws java.io.IOException, java.lang.InterruptedException
Execute command line- Specified by:
execute
in interfaceCommandline
- Parameters:
cmd
- command line- Returns:
- output of command
- Throws:
java.io.IOException
java.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:
execute
in interfaceCommandline
- Parameters:
dir
- file working directorycmd
- command line- Returns:
- output of command
- Throws:
java.io.IOException
java.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:
execute
in interfaceCommandline
- Parameters:
cmd
- command line- Returns:
- output of command
- Throws:
java.io.IOException
java.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:
execute
in interfaceCommandline
- Parameters:
dir
- file working directorycmd
- command line- Returns:
- output of command
- Throws:
java.io.IOException
java.lang.InterruptedException
-
execute
public ProcessOutput execute(java.lang.String[] cmd) throws java.io.IOException, java.lang.InterruptedException
Execute command line- Specified by:
execute
in interfaceCommandline
- Parameters:
cmd
- command line- Returns:
- output of command
- Throws:
java.io.IOException
java.lang.InterruptedException
-
getTimeout
public long getTimeout()
- Specified by:
getTimeout
in interfaceCommandline
- Returns:
-
setTimeout
public void setTimeout(long timeout)
- Specified by:
setTimeout
in interfaceCommandline
-
isLogEnabled
public boolean isLogEnabled()
- Specified by:
isLogEnabled
in interfaceCommandline
- Returns:
-
setLogEnabled
public void setLogEnabled(boolean logEnabled)
-
-