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/MicroExport.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/MicroExport.java')
| -rw-r--r-- | micropeak/MicroExport.java | 15 | 
1 files changed, 7 insertions, 8 deletions
| diff --git a/micropeak/MicroExport.java b/micropeak/MicroExport.java index 219184da..4b83bb4d 100644 --- a/micropeak/MicroExport.java +++ b/micropeak/MicroExport.java @@ -31,6 +31,12 @@ public class MicroExport extends JFileChooser {  	JFrame		frame;  	MicroData	data; +	public static void export(File file, MicroData data) throws FileNotFoundException, IOException { +		FileWriter fw = new FileWriter(file); +		data.export(fw); +		fw.close(); +	} +  	public boolean runDialog() {  		int	ret; @@ -76,14 +82,7 @@ public class MicroExport extends JFileChooser {  				}  			}  			try { -				FileWriter fw = new FileWriter(file); -				PrintWriter pw = new PrintWriter(fw); -				pw.printf("  Time, Press, Height,  Speed,  Accel\n"); -				for (MicroDataPoint point : data.points()) { -					pw.printf("%6.3f,%6.0f,%7.1f,%7.2f,%7.2f\n", -						  point.time, point.pressure, point.height, point.speed, point.accel); -				} -				fw.close(); +				export(file, data);  				return true;  			} catch (FileNotFoundException fe) {  				JOptionPane.showMessageDialog(frame, | 
