/** * Utility method to load a flow from a file * * @param flowFile the file to load from * @param log the log to use * @return the loaded Flow * @throws WekaException if a problem occurs */ public static Flow loadFlow(File flowFile, Logger log) throws WekaException { String extension = "kf"; if (flowFile.toString().lastIndexOf('.') > 0) { extension = flowFile .toString() .substring(flowFile.toString().lastIndexOf('.') + 1, flowFile.toString().length()); } FlowLoader toUse = getFlowLoader(extension, log); if (toUse == null) { throw new WekaException("Was unable to find a loader for flow file: " + flowFile.toString()); } return toUse.readFlow(flowFile); }
/** * Utility method to load a flow from the supplied reader using the supplied FlowLoader * * @param r the reader to load from * @param loader the FlowLoader to use * @return the loaded flow * @throws WekaException if a problem occurs */ public static Flow loadFlow(Reader r, FlowLoader loader) throws WekaException { return loader.readFlow(r); }
/** * Utility method to load a flow from the supplied input stream using the supplied FlowLoader * * @param is the input stream to load from * @param loader the FlowLoader to use * @return the loaded Flow * @throws WekaException if a problem occurs */ public static Flow loadFlow(InputStream is, FlowLoader loader) throws WekaException { return loader.readFlow(is); }