Switch to side-by-side view

--- a/src/main/java/net/timbusproject/dpes/alternative/kb/VirtualPackageAlternativeIdentifier.java
+++ b/src/main/java/net/timbusproject/dpes/alternative/kb/VirtualPackageAlternativeIdentifier.java
@@ -33,6 +33,7 @@
 import java.util.Map.Entry;
 import java.util.Scanner;
 import java.util.Set;
+import java.util.zip.GZIPOutputStream;
 
 import org.apache.commons.cli.BasicParser;
 import org.apache.commons.cli.CommandLine;
@@ -211,13 +212,12 @@
         return allPackages;
     }
 
-    public void storeResults(HashMap<String, HashMap<String, Set<String>>> packagesProviders)
-            throws FileNotFoundException {
+    public void storeResults(HashMap<String, HashMap<String, Set<String>>> packagesProviders) throws IOException {
         System.out.println("Storing results");
         String osName = OSIdentifier.getEscapedOSString();
 
         // convert to all subsets to one single XML
-        writeAsXML(packagesProviders, "providers-" + osName);
+        writeAsXML(packagesProviders, "providers-" + osName, false);
 
         // One Excel sheet that will contain all sub-sections
         Workbook wb = new XSSFWorkbook();
@@ -235,12 +235,17 @@
         }
     }
 
-    public static File writeAsXML(Object data, String fileName) throws FileNotFoundException {
+    public static File writeAsXML(Object data, String fileName, boolean gzip) throws IOException {
         String xml = xStream.toXML(data);
         final File file = new File(PATH + fileName + ".xml");
-        PrintWriter xmlOutput = new PrintWriter(file);
-        xmlOutput.println(xml);
-        xmlOutput.close();
+        PrintWriter pw;
+        if (gzip) {
+            pw = new PrintWriter(new GZIPOutputStream(new FileOutputStream(file)));
+        } else {
+            pw = new PrintWriter(file);
+        }
+        pw.println(xml);
+        pw.close();
         return file;
     }
 
@@ -381,7 +386,7 @@
         return resultMap;
     }
 
-    public static void main(String... args) throws FileNotFoundException {
+    public static void main(String... args) throws IOException {
         VirtualPackageAlternativeIdentifier virtualPackageProviderIdentifier = new VirtualPackageAlternativeIdentifier();
         HashMap<String, HashMap<String, Set<String>>> packagesProviders = null;