()
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | protected Schema checkHeader() throws IOException { |
| 50 | // Extract current schema |
| 51 | Schema schema = WyilFile.getSchema(); |
| 52 | // Check magic number |
| 53 | for (int i = 0; i != 8; ++i) { |
| 54 | char c = (char) in.read_u8(); |
| 55 | if (magic[i] != c) { |
| 56 | throw new IllegalArgumentException("invalid magic number"); |
| 57 | } |
| 58 | } |
| 59 | // Check version number |
| 60 | majorVersion = in.read_uv(); |
| 61 | minorVersion = in.read_uv(); |
| 62 | // |
| 63 | if (majorVersion > schema.getMajorVersion() |
| 64 | || (majorVersion == schema.getMajorVersion() && minorVersion > schema.getMinorVersion())) { |
| 65 | String msg = "WyilFile compiled with newer version of WyC [" + majorVersion + "." + minorVersion |
| 66 | + " > " + schema.getMajorVersion() + "." + schema.getMinorVersion() + "]"; |
| 67 | throw new Syntactic.Exception(msg, null, null); |
| 68 | } else { |
| 69 | schema = selectSchema(majorVersion,minorVersion,schema); |
| 70 | } |
| 71 | // Pad to next byte boundary |
| 72 | in.pad_u8(); |
| 73 | // |
| 74 | return schema; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Select the most appropriate schema for decoding this file based on its |
nothing calls this directly
no test coverage detected