Moved bit input and output streams into Svjatoslav Commons library.
[imagesqueeze.git] / src / main / java / eu / svjatoslav / imagesqueeze / sampleApplication / Main.java
index f67ff3a..0e2ccce 100755 (executable)
@@ -1,45 +1,50 @@
+/*
+ * Imagesqueeze - Image codec optimized for photos.
+ * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
 package eu.svjatoslav.imagesqueeze.sampleApplication;
 
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 
-
-
 public class Main {
 
-       public static void main(String[] args) {
+       public static void main(final String[] args) {
 
                try {
 
-                       String image = "colorful photo";
-                       String sourceDirectory = "/eu/svjatoslav/imagesqueeze/sampleApplication/data/";
-                       
+                       final String image = "colorful photo";
+                       final String sourceDirectory = "/eu/svjatoslav/imagesqueeze/sampleApplication/data/";
+
                        // create visible frame
                        // load image into frame
-                       InputStream inputStream = Main.class.getResourceAsStream(sourceDirectory + image + ".png");
-                       
-                       ImageFrame frame = new ImageFrame("Original image");
-                       frame.getImagePanel().loadImage(inputStream, false);                    
-                       frame.setVisible(true);
+                       final InputStream inputStream = Main.class
+                                       .getResourceAsStream(sourceDirectory + image + ".png");
 
+                       final ImageFrame frame = new ImageFrame("Original image");
+                       frame.getImagePanel().loadImage(inputStream, false);
+                       frame.setVisible(true);
 
                        // encode image into file
                        frame.getImagePanel().saveImage(new File(image + ".ImgSqz"));
 
-
                        // create second frame for decoded image
-                       ImageFrame frame2 = new ImageFrame("Encoded -> Decoded");
+                       final ImageFrame frame2 = new ImageFrame("Encoded -> Decoded");
 
                        // decode image
                        frame2.getImagePanel().loadImage(new File(image + ".ImgSqz"), true);
                        frame2.setVisible(true);
 
-               } catch (IOException exception){
+               } catch (final IOException exception) {
                        System.out.println("Error while loading an image: " + exception);
                }
 
-
        }
 
 }