sourceChannel = sourceStream.getChannel();
destinationStream = new FileOutputStream(newFile);
destinationChannel = destinationStream.getChannel();
destinationChannel.transferFrom(sourceChannel, 0, sourceChannel.size());
File directory = historyFile.getParentFile();
boolean deleted = historyFile.delete();
if (!deleted) {
throw new WorkflowException("The old history file could not be deleted!");
}