public class ProcessFacade extends Object
| Constructor and Description |
|---|
ProcessFacade()
コンストラクタ。
|
ProcessFacade(File directory,
String... args)
コンストラクタ。
|
ProcessFacade(String... args)
コンストラクタ。
|
| Modifier and Type | Method and Description |
|---|---|
ProcessBuilder |
builder()
プロセスビルダを返す。
|
void |
close()
リソースを解放しプロセスを終了させる(終了を待機する)。
プロセスが開始されていない場合は何もしない。
|
void |
close(int timeoutMillis)
リソースを解放しプロセスを終了させる(終了を待機する)。
プロセスが開始されていない場合は何もしない。
|
void |
closeStreams()
出力ストリーム、入力ストリームの順でcloseメソッドを呼び出す。
出力ストリームのcloseでIOExceptionが生じても、入力ストリームのcloseを呼び出す。
|
int |
exitValue() |
InputStream |
getErrorStream()
入力ストリームを取得する。
プロセスが開始されていない場合、IllegalStateException(非チェック例外)が発生する。
|
InputStream |
getInputStream()
入力ストリームを取得する。
プロセスが開始されていない場合、IllegalStateException(非チェック例外)が発生する。
|
OutputStream |
getOutputStream()
出力ストリームを取得する。
プロセスが開始されていない場合、IllegalStateException(非チェック例外)が発生する。
|
void |
start()
プロセスを開始する。
|
void |
waitFor()
起動したプロセスの終了を待機する。
プロセスが開始されていない場合は何もしない。
|
void |
waitFor(int timeoutMillis)
起動したプロセスの終了を待機する。
プロセスが開始されていない場合は何もしない。
|
public ProcessFacade(File directory, String... args)
args - 実行するコマンド文字列public ProcessFacade(String... args)
args - 実行するコマンド文字列public ProcessFacade()
public ProcessBuilder builder()
public void start()
throws IOException
IOException - プロセスの開始に失敗したpublic InputStream getInputStream() throws IllegalStateException
IllegalStateException - プロセスが開始されていないpublic InputStream getErrorStream() throws IllegalStateException
IllegalStateException - プロセスが開始されていないpublic OutputStream getOutputStream()
IllegalStateException - プロセスが開始されていないpublic void closeStreams()
throws IOException
IOException - ストリームのclose呼び出しに失敗したpublic void waitFor()
throws InterruptedException
InterruptedException - 待機操作が中断されたpublic int exitValue()
public void waitFor(int timeoutMillis)
throws InterruptedException,
TimeoutException
timeoutMillis - 待機するミリ秒数InterruptedException - 待機操作が中断されたTimeoutException - 待機時間を経過してもプロセスが終了しなかったpublic void close()
throws InterruptedException,
IOException
InterruptedException - 待機操作が中断されたIOException - ストリームのクローズに失敗したpublic void close(int timeoutMillis)
throws InterruptedException,
IOException,
TimeoutException
timeoutMillis - 待機するミリ秒数InterruptedException - 待機操作が中断されたIOException - ストリームのクローズに失敗したTimeoutException - 待機時間を経過してもプロセスが終了しなかった