List of utility methods to do XML JAXB Marshaller
void | marshal(JAXBContext context, Object object, Writer writer, Map marshal if (object == null) { return; if (writer == null) { return; if (context == null) { context = JAXBContext.newInstance(object.getClass()); ... |
void | marshal(JAXBElement> e, File f) Marshals the given element to file. mar.marshal(e, f); |
Element | marshal(JAXBElement marshal try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.newDocument();
JAXBContext jaxbContext = JAXBContext.newInstance(cls);
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.marshal(jaxbElement, doc);
...
|
void | marshal(JAXBElement Kirjoitetaan XML-dataa. JAXBContext jc = JAXBContext.newInstance(contextPath, classLoader); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(value, out); |
void | marshal(Marshaller m, File out, Object o) Stores object into file. try (FileOutputStream fos = new FileOutputStream(out)) { m.marshal(o, fos); } catch (JAXBException ex) { throw new IOException("Cannot write object to file - " + ex.getMessage(), ex); |
void | marshal(Marshaller marshaller, Object object, String filename) marshal marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); FileOutputStream fileOutputStream = null; try { fileOutputStream = new FileOutputStream(filename); marshaller.marshal(object, fileOutputStream); } finally { if (fileOutputStream != null) { try { ... |
void | marshal(Marshaller marshaller, Object object, String filename) marshal marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); FileOutputStream fileOutputStream = null; try { fileOutputStream = new FileOutputStream(filename); marshaller.marshal(object, fileOutputStream); } finally { if (fileOutputStream != null) { try { ... |
String | marshal(Object bean) marshal StringWriter writer = new StringWriter(); getMarshaller().marshal(bean, writer); return writer.toString(); |
byte[] | marshal(Object entity) Marshal an object into a byte array. return marshal(entity, ImmutableMap.<String, Object>of(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE,
Marshaller.JAXB_ENCODING, StandardCharsets.UTF_8.toString()));
|
DOMResult | marshal(Object obj) marshal DOMResult domResult = new DOMResult(); try { getMarshaller().marshal(obj, domResult); } catch (Exception e) { throw new RuntimeException("Cannot serialize object: " + obj, e); return domResult; |