micropeak: Add command line export option
[fw/altos] / micropeak / MicroSave.java
index cb4b4221d3b0b0d2e14ff7b121cfc7969e8863b8..2664f170c375ba2691ffc32490a774c157394b7e 100644 (file)
@@ -32,6 +32,12 @@ public class MicroSave extends JFileChooser {
        JFrame          frame;
        MicroData       data;
 
+       public static void save(File file, MicroData data) throws FileNotFoundException, IOException {
+               FileOutputStream fos = new FileOutputStream(file);
+               data.save(fos);
+               fos.close();
+       }
+
        public boolean runDialog() {
                int     ret;
 
@@ -76,9 +82,7 @@ public class MicroSave extends JFileChooser {
                                }
                        }
                        try {
-                               FileOutputStream fos = new FileOutputStream(file);
-                               data.save(fos);
-                               fos.close();
+                               save(file, data);
                                data.set_name(filename);
                                return true;
                        } catch (FileNotFoundException fe) {