private void saveConfiguration(
      BundleInfo[] configuration, File outputFile, URI installArea, boolean backup)
      throws IOException {
    if (backup && outputFile.exists()) {
      File backupFile = Utils.getSimpleDataFormattedFile(outputFile);
      if (!outputFile.renameTo(backupFile)) {
        throw new IOException("Fail to rename from (" + outputFile + ") to (" + backupFile + ")");
      }
    }

    org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo[] simpleInfos =
        convertBundleInfos(configuration, installArea);

    // if empty remove the configuration file
    if (simpleInfos == null || simpleInfos.length == 0) {
      if (outputFile.exists()) {
        outputFile.delete();
      }
      File parentDir = outputFile.getParentFile();
      if (parentDir.exists()) {
        parentDir.delete();
      }
      return;
    }
    SimpleConfiguratorManipulatorUtils.writeConfiguration(simpleInfos, outputFile);
    if (CONFIG_LIST.equals(outputFile.getName())
        && installArea != null
        && isSharedInstallSetup(URIUtil.toFile(installArea), outputFile))
      rememberSharedBundlesInfoTimestamp(installArea, outputFile.getParentFile());
  }
 public void saveConfiguration(BundleInfo[] configuration, OutputStream stream, URI installArea)
     throws IOException {
   org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo[] simpleInfos =
       convertBundleInfos(configuration, installArea);
   SimpleConfiguratorManipulatorUtils.writeConfiguration(simpleInfos, stream);
 }