diff options
author | Keith Packard <keithp@keithp.com> | 2013-01-01 15:30:11 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-01-01 15:30:11 -0800 |
commit | d83587c3c66b730cc54ca153714eee520ee40b2c (patch) | |
tree | f3f77de67c0e918a8681f39a793235be0a66fc50 /micropeak/MicroData.java | |
parent | 65b512c890a3ccf487655b79305ab1cfcf49259c (diff) |
micropeak is code complete now.
Added save and download functionality. Removed 'new' from file menu.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'micropeak/MicroData.java')
-rw-r--r-- | micropeak/MicroData.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/micropeak/MicroData.java b/micropeak/MicroData.java index ec9b83d8..8ccd5fd8 100644 --- a/micropeak/MicroData.java +++ b/micropeak/MicroData.java @@ -110,6 +110,7 @@ public class MicroData { private double time_step; private double ground_altitude; private ArrayList<Integer> bytes; + String name; class FileEndedException extends Exception { @@ -310,12 +311,18 @@ public class MicroData { public void save (OutputStream f) throws IOException { for (int c : bytes) f.write(c); + f.write('\n'); } - public MicroData (InputStream f) throws IOException { + public void set_name(String name) { + this.name = name; + } + + public MicroData (InputStream f, String name) throws IOException, InterruptedException { + this.name = name; bytes = new ArrayList<Integer>(); if (!find_header(f)) - throw new IOException(); + throw new IOException("No MicroPeak data header found"); try { file_crc = 0xffff; ground_pressure = get_32(f); @@ -354,9 +361,9 @@ public class MicroData { time_step = 0.192; } catch (FileEndedException fe) { - throw new IOException(); + throw new IOException("File Ended Unexpectedly"); } catch (NonHexcharException ne) { - throw new IOException(); + throw new IOException("Non hexadecimal character found"); } } |