public class Command extends Object
Runtime.exec(String)
.Modifier and Type | Class and Description |
---|---|
static interface |
Command.StreamConsumer<T>
Interface for a type consuming and
InputStream . |
Constructor and Description |
---|
Command() |
Modifier and Type | Method and Description |
---|---|
static int |
execute(OperatingSystem os,
String command,
Command.StreamConsumer<?> outputConsumer,
Command.StreamConsumer<?> errorConsumer)
Executes the given command, but only if the given
OperatingSystem matches. |
static int |
execute(String command,
Command.StreamConsumer<?> outputConsumer,
Command.StreamConsumer<?> errorConsumer)
Executes the given command.
|
public static final int ERROR
public static final int WRONG_OS
public static int execute(String command, Command.StreamConsumer<?> outputConsumer, Command.StreamConsumer<?> errorConsumer)
command
- the command to executeoutputConsumer
- a Command.StreamConsumer
to consume Process.getInputStream()
errorConsumer
- a Command.StreamConsumer
to consume Process.getErrorStream()
Process.waitFor()
, or -1 if an exception occurred while
executing the process.public static int execute(OperatingSystem os, String command, Command.StreamConsumer<?> outputConsumer, Command.StreamConsumer<?> errorConsumer)
OperatingSystem
matches.os
- the target OperatingSystem
command
- the command to executeoutputConsumer
- a Command.StreamConsumer
to consume Process.getInputStream()
errorConsumer
- a Command.StreamConsumer
to consume Process.getErrorStream()
execute(String, StreamConsumer, StreamConsumer)
, if the current
OperatingSystem
matches the desired one, otherwise -2execute(String, StreamConsumer, StreamConsumer)
Copyright © 2011–2023 aiticon GmbH. All rights reserved.