Checks if the given file is a binary external events file @param file The file to check @return True if the file is a binary ee file, false if not
(File file)
| 79 | * @return True if the file is a binary ee file, false if not |
| 80 | */ |
| 81 | public static boolean isBinaryEeFile(File file) { |
| 82 | if (!file.getName().endsWith(BINARY_EXT)) { |
| 83 | return false; |
| 84 | } |
| 85 | |
| 86 | // extension matches, try to read an event |
| 87 | try { |
| 88 | BinaryEventsReader r = new BinaryEventsReader(file); |
| 89 | r.readEvents(1); |
| 90 | r.close(); |
| 91 | } |
| 92 | catch (SimError e) { |
| 93 | return false; // read failed -> not a valid file |
| 94 | } |
| 95 | |
| 96 | return true; // seems to be a valid binary ee file |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Stores the events to a binary file |
no test coverage detected