diff options
Diffstat (limited to 'altoslib/AltosStateIterable.java')
| -rw-r--r-- | altoslib/AltosStateIterable.java | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/altoslib/AltosStateIterable.java b/altoslib/AltosStateIterable.java index f7cd424d..4154b71c 100644 --- a/altoslib/AltosStateIterable.java +++ b/altoslib/AltosStateIterable.java @@ -26,4 +26,18 @@ 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); +		} catch (Exception e) { +			System.out.printf("Failed to open file '%s'\n", file); +			return null; +		} +		if (file.getName().endsWith("telem")) +			return new AltosTelemetryFile(in); +		else +			return new AltosEepromFile(in); +	}  } | 
