src/main/java/skadistats/clarity/source/Source.java
public EngineType readEngineType() throws IOException {
        try {
            engineType = EngineId.typeForMagic(new String(readBytes(8)));
            if (engineType == null) {
                throw new IOException();
            }
            return engineType;
        } catch (IOException e) {
            throw new IOException("given stream does not seem to contain a valid replay");
        }
    }
public EngineType readEngineType() throws IOException {
        try {
            engineType = EngineId.typeForMagic(new String(readBytes(8)));
            if (engineType == null) {
                throw new IOException();
            }
            return engineType;
        } catch (IOException e) {
            throw new IOException("given stream does not seem to contain a valid replay");
        }
    }
reads the magic of a demo file, identifying the engine type

@throws IOException if there is not enough data or the if no valid magic was found