X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=micropeak%2FMicroData.java;h=8ccd5fd8a88e21ec9ef592777d4c8e03e210e1dd;hb=9efc57e4052e3c11218973f7666ad18ea5cf2a5a;hp=ec9b83d8179e0902bc82c74de968bfac996b9e54;hpb=2bd6aca54fc465995d6985c8799cd0d016c9a543;p=fw%2Faltos 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 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(); 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"); } }