/** * @see JAXBUtil#marshalPMML(PMML, Result) */ static public void marshal(PMML pmml, OutputStream os) throws JAXBException { StreamResult result = new StreamResult(os); JAXBUtil.marshalPMML(pmml, result); } }
/** * @see JAXBUtil#marshalPMML(PMML, Result) */ static public void marshal(PMML pmml, OutputStream os) throws JAXBException { StreamResult result = new StreamResult(os); JAXBUtil.marshalPMML(pmml, result); } }
public static void savePMML(PMML pmml, String path) { OutputStream os = null; try { os = new FileOutputStream(path); StreamResult result = new StreamResult(os); JAXBUtil.marshalPMML(pmml, result); } catch (Exception e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(os); } }
public static void savePMML(PMML pmml, String path) { OutputStream os = null; try { os = new FileOutputStream(path); StreamResult result = new StreamResult(os); JAXBUtil.marshalPMML(pmml, result); } catch (Exception e) { e.printStackTrace(); } }
/** * Quite manually write our fake model representation in PMML. */ private static void write(OutputStream out, ALSModelDescription model) throws JAXBException { PMML pmml = new PMML("4.2.1", null, null); for (Map.Entry<String,String> entry : model.getPathByKey().entrySet()) { Extension extension = new Extension(); extension.setName(entry.getKey()); extension.setValue(entry.getValue()); pmml.getExtensions().add(extension); } JAXBUtil.marshalPMML(pmml, new StreamResult(out)); }
@Test public void copy() throws Exception { PMML pmml; try(InputStream is = ResourceUtil.getStream(Version.PMML_4_3)){ pmml = JAXBUtil.unmarshalPMML(new StreamSource(is)); } assertEquals(PMML.class, pmml.getClass()); ByteArrayOutputStream os = new ByteArrayOutputStream(); JAXBUtil.marshalPMML(pmml, new StreamResult(os)); assertTrue(os.size() > 0); }