String command = getKduExtractCommand(input, output, dims, params);
String[] cmdParts = CommandLineTokenizer.tokenize(command);
Process process = Runtime.getRuntime().exec(cmdParts, envParams, new File(env));
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
ByteArrayOutputStream stderr = new ByteArrayOutputStream();
ExecuteStreamHandler streamHandler = new PumpStreamHandler(stdout, stderr, is);
try {
streamHandler.setProcessInputStream(process.getOutputStream());
streamHandler.setProcessOutputStream(process.getInputStream());
streamHandler.setProcessErrorStream(process.getErrorStream());
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
if (process != null) {
closeStreams(process);
}
throw e;
}
streamHandler.start();
try {
waitFor(process);
final ByteArrayInputStream bais = new ByteArrayInputStream(stdout.toByteArray());
bi = new PNMReader().open(bais);
streamHandler.stop();
} catch (ThreadDeath t) {
LOGGER.error(t.getMessage(), t);
process.destroy();
throw t;
} finally {