summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-05-09 00:20:23 -0700
committerKeith Packard <keithp@keithp.com>2017-05-09 00:20:23 -0700
commitc00a80f040de85be18c9d5150cb0661e08158c3d (patch)
treeb632544e463e77037d1a867d3fce30db13ea2f52
parente14b0ea82420e769cdf9ffd621b7f8d4944ef44d (diff)
altoslib: Hack up AltosEepromFile to support new eeprom code
Redirect when asked to read an eeprom file using the "Reader" type. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altoslib/AltosEepromFile.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/altoslib/AltosEepromFile.java b/altoslib/AltosEepromFile.java
index 5544ec37..bb8abf87 100644
--- a/altoslib/AltosEepromFile.java
+++ b/altoslib/AltosEepromFile.java
@@ -58,6 +58,7 @@ public class AltosEepromFile extends AltosStateIterable {
AltosEepromIterable headers;
AltosEepromIterable body;
+ AltosEepromRecordSet set;
AltosState start;
public void write_comments(PrintStream out) {
@@ -69,6 +70,11 @@ public class AltosEepromFile extends AltosStateIterable {
body.write(out);
}
+ public AltosEepromFile(Reader input) throws IOException {
+ set = new AltosEepromRecordSet(input);
+
+ }
+
public AltosEepromFile(FileInputStream input) {
headers = new AltosEepromIterable(AltosEepromHeader.read(input));
@@ -130,6 +136,9 @@ public class AltosEepromFile extends AltosStateIterable {
}
public Iterator<AltosState> iterator() {
+ if (set != null)
+ return set.iterator();
+
AltosState state = start.clone();
Iterator<AltosEeprom> i = body.iterator();