MCPcopy Create free account
hub / github.com/akeranen/the-one / isBinaryEeFile

Method isBinaryEeFile

input/BinaryEventsReader.java:81–97  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

initMethod · 0.95

Calls 3

readEventsMethod · 0.95
closeMethod · 0.95
getNameMethod · 0.80

Tested by

no test coverage detected