* Check the magic number, which is expected to be exactly 3 bytes forming the "CDF" string.
* The 4th byte is the version number, which we opportunistically use after the magic number check.
*/
int version = input.readInt();
if ((version & 0xFFFFFF00) != MAGIC_NUMBER) {
throw new DataStoreException(errors().getString(Errors.Keys.UnexpectedFileFormat_2, "NetCDF", input.filename));
}
/*
* Check the version number.
*/
version &= 0xFF;
switch (version) {
case 1: is64bits = false; break;
case 2: is64bits = true; break;
default: throw new DataStoreException(errors().getString(Errors.Keys.UnsupportedVersion_1, version));
}
numrecs = input.readInt();
/*
* Read the dimension, attribute and variable declarations. We expect exactly 3 lists,
* where any of them can be flagged as absent by a long (64 bits) 0.