forked from JavaDevTeam/notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava-lang-ProcessBuilder.java
More file actions
53 lines (39 loc) · 1.53 KB
/
Copy pathjava-lang-ProcessBuilder.java
File metadata and controls
53 lines (39 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
-----------------------------
ProcessBuilder |
-----------------------------
# 子进程任务构建工厂类
# 构造函数
public ProcessBuilder(String... command)
public ProcessBuilder(List<String> command)
-----------------------------
ProcessBuilder |
-----------------------------
-----------------------------
ProcessBuilder - 实例方法 |
-----------------------------
public ProcessBuilder command(String... command)
public ProcessBuilder command(List<String> command)
public List<String> command()
* 设置/返回执行命令
* 返回 this
public Map<String,String> environment()
public File directory()
public ProcessBuilder directory(File directory)
* 设置/返回工作目录
Process start() throws Exception
* 执行
public ProcessBuilder redirectInput(Redirect source)
public ProcessBuilder redirectOutput(Redirect destination)
public ProcessBuilder redirectError(Redirect destination)
* 属性默认值为false,子进程的标准输出和错误输出被发送给两个独立的流,这些流可以通过 Process.getInputStream() 和 Process.getErrorStream() 方法来访问。
* 是否合并标准错误和标准输出;true为合并,false为不合
public ProcessBuilder redirectInput(File file)
public ProcessBuilder redirectOutput(File file)
public ProcessBuilder redirectError(File file)
public Redirect redirectInput()
public Redirect redirectOutput()
public Redirect redirectError()
public ProcessBuilder inheritIO()
public boolean redirectErrorStream()
public ProcessBuilder redirectErrorStream(boolean redirectErrorStream)
public Process start() throws IOException