Here you can find the source of marshal(Marshaller m, File out, Object o)
Parameter | Description |
---|---|
m | marshaller |
out | output file |
o | object to be stored |
Parameter | Description |
---|---|
IOException | if some error occurs |
private static void marshal(Marshaller m, File out, Object o) throws IOException
//package com.java2s; //License from project: LGPL import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; public class Main { /**/*from ww w.j a v a2 s. c o m*/ * Stores object into file. * * @param m marshaller * @param out output file * @param o object to be stored * @throws IOException if some error occurs */ private static void marshal(Marshaller m, File out, Object o) throws IOException { try (FileOutputStream fos = new FileOutputStream(out)) { m.marshal(o, fos); } catch (JAXBException ex) { throw new IOException("Cannot write object to file - " + ex.getMessage(), ex); } } }