public class Shell extends Object implements Cloneable
command.com
cmd.exe
Constructor and Description |
---|
Shell() |
Modifier and Type | Method and Description |
---|---|
void |
addShellArg(String arg) |
void |
clearArguments() |
Object |
clone() |
protected String |
getArgumentEscapePattern() |
protected char |
getArgumentQuoteDelimiter() |
List<String> |
getCommandLine(String executable,
String[] arguments)
Get the command line for the provided executable and arguments in this shell
|
protected char[] |
getEscapeChars(boolean includeSingleQuote,
boolean includeDoubleQuote) |
String |
getExecutable() |
protected char |
getExecutableQuoteDelimiter() |
protected String |
getExecutionPreamble() |
List<String> |
getOriginalCommandLine(String executable,
String[] arguments) |
String |
getOriginalExecutable() |
protected char[] |
getQuotingTriggerChars() |
protected List<String> |
getRawCommandLine(String executable,
String[] arguments) |
String[] |
getShellArgs() |
List<String> |
getShellArgsList() |
String |
getShellCommand()
Get the command to execute the shell
|
List<String> |
getShellCommandLine(String[] arguments)
Get the full command line to execute, including shell command, shell arguments, executable and executable
arguments
|
File |
getWorkingDirectory() |
String |
getWorkingDirectoryAsString() |
protected boolean |
isDoubleQuotedArgumentEscaped() |
protected boolean |
isDoubleQuotedExecutableEscaped() |
boolean |
isQuotedArgumentsEnabled() |
boolean |
isQuotedExecutableEnabled() |
protected boolean |
isSingleQuotedArgumentEscaped() |
protected boolean |
isSingleQuotedExecutableEscaped() |
protected String |
quoteOneItem(String inputString,
boolean isExecutable) |
protected void |
setArgumentEscapePattern(String argumentEscapePattern) |
protected void |
setArgumentQuoteDelimiter(char argQuoteDelimiter) |
protected void |
setDoubleQuotedArgumentEscaped(boolean doubleQuotedArgumentEscaped) |
protected void |
setDoubleQuotedExecutableEscaped(boolean doubleQuotedExecutableEscaped) |
void |
setExecutable(String executable) |
protected void |
setExecutableQuoteDelimiter(char exeQuoteDelimiter) |
void |
setQuotedArgumentsEnabled(boolean quotedArgumentsEnabled) |
void |
setQuotedExecutableEnabled(boolean quotedExecutableEnabled) |
void |
setShellArgs(String[] shellArgs)
Set the shell arguments when calling a command line (not the executable arguments) (eg.
|
void |
setShellCommand(String shellCommand)
Set the command to execute the shell (eg.
|
protected void |
setSingleQuotedArgumentEscaped(boolean singleQuotedArgumentEscaped) |
protected void |
setSingleQuotedExecutableEscaped(boolean singleQuotedExecutableEscaped) |
void |
setUnconditionalQuoting(boolean unconditionallyQuote)
Toggle unconditional quoting
|
void |
setWorkingDirectory(File workingDir) |
void |
setWorkingDirectory(String path) |
public void setUnconditionalQuoting(boolean unconditionallyQuote)
unconditionallyQuote
- see namepublic void setShellCommand(String shellCommand)
shellCommand
- see namepublic String getShellCommand()
public void setShellArgs(String[] shellArgs)
shellArgs
- see namepublic String[] getShellArgs()
public List<String> getCommandLine(String executable, String[] arguments)
executable
- executable that the shell has to callarguments
- arguments for the executable, not the shellprotected char[] getQuotingTriggerChars()
protected String getExecutionPreamble()
protected char[] getEscapeChars(boolean includeSingleQuote, boolean includeDoubleQuote)
protected boolean isDoubleQuotedArgumentEscaped()
protected boolean isSingleQuotedArgumentEscaped()
protected boolean isDoubleQuotedExecutableEscaped()
protected boolean isSingleQuotedExecutableEscaped()
protected void setArgumentQuoteDelimiter(char argQuoteDelimiter)
protected char getArgumentQuoteDelimiter()
protected void setExecutableQuoteDelimiter(char exeQuoteDelimiter)
protected char getExecutableQuoteDelimiter()
protected void setArgumentEscapePattern(String argumentEscapePattern)
protected String getArgumentEscapePattern()
public List<String> getShellCommandLine(String[] arguments)
arguments
- arguments for the executable, not the shellpublic void addShellArg(String arg)
public void setQuotedArgumentsEnabled(boolean quotedArgumentsEnabled)
public boolean isQuotedArgumentsEnabled()
public void setQuotedExecutableEnabled(boolean quotedExecutableEnabled)
public boolean isQuotedExecutableEnabled()
public void setExecutable(String executable)
executable
- Sets the executable to run.public String getExecutable()
public void setWorkingDirectory(String path)
path
- Sets execution directory.public void setWorkingDirectory(File workingDir)
workingDir
- Sets execution directory.public File getWorkingDirectory()
public String getWorkingDirectoryAsString()
public void clearArguments()
public String getOriginalExecutable()
public List<String> getOriginalCommandLine(String executable, String[] arguments)
protected void setDoubleQuotedArgumentEscaped(boolean doubleQuotedArgumentEscaped)
protected void setDoubleQuotedExecutableEscaped(boolean doubleQuotedExecutableEscaped)
protected void setSingleQuotedArgumentEscaped(boolean singleQuotedArgumentEscaped)
protected void setSingleQuotedExecutableEscaped(boolean singleQuotedExecutableEscaped)
Copyright © 2001–2022 The Apache Software Foundation. All rights reserved.