X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altoslib%2FAltosEepromNew.java;fp=altoslib%2FAltosEepromNew.java;h=b76e3e1964d0876fc3ac55fe2511c0465ddbab6b;hp=c8f44509d19e8a33b9dce623a01d506bc59c2909;hb=17e20a6d2dab1f4bd1375bfd9e1c5230ee2c1119;hpb=e311cefae19d7dc71fb10e9a943daa8e2313c8f8 diff --git a/altoslib/AltosEepromNew.java b/altoslib/AltosEepromNew.java index c8f44509..b76e3e19 100644 --- a/altoslib/AltosEepromNew.java +++ b/altoslib/AltosEepromNew.java @@ -103,29 +103,22 @@ public class AltosEepromNew { return true; } - static private byte[] byte_list_to_array(List bytes) { - byte[] data = new byte[bytes.size()]; - int i = 0; - - for (Byte b : bytes) { - data[i++] = b; - } - return data; - } - private boolean read_data(Reader r) throws IOException { BufferedReader br = new BufferedReader(r); String s; data = new ArrayList(); while ((s = br.readLine()) != null) { + String[] tokens = s.split("\\s+"); for (int i = 0; i < tokens.length; i++) { - try { - data.add((byte) AltosLib.fromhex(tokens[i])); - } catch (NumberFormatException e) { - throw new IOException(e.toString()); + if (tokens[i].length() > 0) { + try { + data.add((byte) AltosLib.fromhex(tokens[i])); + } catch (NumberFormatException e) { + throw new IOException(e.toString()); + } } } } @@ -270,6 +263,16 @@ public class AltosEepromNew { read(new StringReader(s)); } + public AltosEepromNew(AltosJson config, ArrayList data) { + this.config = config; + this.data = data; + } + + public AltosEepromNew(AltosConfigData config_data, ArrayList data) { + this.config = new AltosJson(config_data); + this.data = data; + } + public AltosEepromNew() { } }