{
outputFile = File.createTempFile("ogsadai-", null);
}
catch (IOException e)
{
throw new ActivityProcessingException(e);
}
}
else
{
outputFile = new File(filename);
}
InputStream input = null;
OutputStream output = null;
try
{
input = (InputStream) iterationData[1];
output = new FileOutputStream(outputFile);
IOUtilities.streamData(input, output);
}
catch (IOException e)
{
throw new ActivityProcessingException(e);
}
finally
{
try
{
if (input != null) input.close();
if (output != null) output.close();
}
catch (IOException e)
{
LOG.warn(e);
}
}
try
{
mOutput.write(outputFile.getAbsolutePath());
}
catch (PipeClosedException e)
{
iterativeStageComplete();
}
catch (PipeIOException e)
{
throw new ActivityProcessingException(e);
}
catch (PipeTerminatedException e)
{
throw new ActivityTerminatedException();
}