diff options
author | Keith Packard <keithp@keithp.com> | 2013-01-03 17:31:01 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-01-03 17:31:01 -0800 |
commit | f20781010a6560b7b359af269c502d098917c446 (patch) | |
tree | aeb9db1b1e4b9597609488b4918676551c75aad5 /micropeak/MicroSave.java | |
parent | 36e9603f74b85776ac049758021b51909161aeb1 (diff) |
micropeak: Add command line export option
micropeak --export <foo.mpd> will create <foo.csv> full of useful data.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'micropeak/MicroSave.java')
-rw-r--r-- | micropeak/MicroSave.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/micropeak/MicroSave.java b/micropeak/MicroSave.java index cb4b4221..2664f170 100644 --- a/micropeak/MicroSave.java +++ b/micropeak/MicroSave.java @@ -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) { |