src/main/java/com/feedzai/fos/impl/weka/utils/pmml/PMMLConsumers.java
public static Classifier consume(File file) throws PMMLConversionException {
        PMML pmml = null;
        try {
            if (isGzipped(file)) {
                logger.debug("Consuming GZipped PMML file '{}'.", file.getAbsolutePath());

                try (FileInputStream fis = new FileInputStream(file);
                     GZIPInputStream gzipInputStream = new GZIPInputStream(fis))
                {
                    pmml = JAXBUtil.unmarshalPMML(new StreamSource(gzipInputStream));
                }
            } else {
                logger.debug("Consuming PMML file '{}'.", file.getAbsolutePath());

                try (FileInputStream fis = new FileInputStream(file)) {
                    pmml = JAXBUtil.unmarshalPMML(new StreamSource(fis));
                }
            }
        } catch (Exception e) {
            throw new PMMLConversionException("Failed to unmarshal PMML file '" + file + "'. Make sure the file is a valid PMML.", e);
        }

        Algorithm algorithm = getAlgorithm(pmml);

        logger.debug("Consumed PMML file using algorithm {}.", algorithm);

        return algorithm.getPMMLConsumer().consume(pmml);
    }
public static Classifier consume(File file) throws PMMLConversionException {
        PMML pmml = null;
        try {
            if (isGzipped(file)) {
                logger.debug("Consuming GZipped PMML file '{}'.", file.getAbsolutePath());

                try (FileInputStream fis = new FileInputStream(file);
                     GZIPInputStream gzipInputStream = new GZIPInputStream(fis))
                {
                    pmml = JAXBUtil.unmarshalPMML(new StreamSource(gzipInputStream));
                }
            } else {
                logger.debug("Consuming PMML file '{}'.", file.getAbsolutePath());

                try (FileInputStream fis = new FileInputStream(file)) {
                    pmml = JAXBUtil.unmarshalPMML(new StreamSource(fis));
                }
            }
        } catch (Exception e) {
            throw new PMMLConversionException("Failed to unmarshal PMML file '" + file + "'. Make sure the file is a valid PMML.", e);
        }

        Algorithm algorithm = getAlgorithm(pmml);

        logger.debug("Consumed PMML file using algorithm {}.", algorithm);

        return algorithm.getPMMLConsumer().consume(pmml);
    }
Consumes the PMML in the given file and converts it to a Weka {@link Classifier}.

@param file The file with the PMML representation of the classifier.
@return A Weka {@link Classifier}.
@throws PMMLConversionException If if fails to consume the PMML file.