summaryrefslogtreecommitdiff
path: root/altoslib/AltosStateIterable.java
diff options
context:
space:
mode:
Diffstat (limited to 'altoslib/AltosStateIterable.java')
-rw-r--r--altoslib/AltosStateIterable.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/altoslib/AltosStateIterable.java b/altoslib/AltosStateIterable.java
index 5332aecd..ec3d944d 100644
--- a/altoslib/AltosStateIterable.java
+++ b/altoslib/AltosStateIterable.java
@@ -29,15 +29,13 @@ public abstract class AltosStateIterable implements Iterable<AltosState> {
public abstract void write(PrintStream out);
public static AltosStateIterable iterable(File file) {
- FileInputStream in;
try {
- in = new FileInputStream(file);
+ if (file.getName().endsWith("telem"))
+ return new AltosTelemetryFile(new FileInputStream(file));
+ else
+ return new AltosEepromFile(new FileReader(file));
} catch (Exception e) {
return null;
}
- if (file.getName().endsWith("telem"))
- return new AltosTelemetryFile(in);
- else
- return new AltosEepromFile(in);
}
}