1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
try {
//Create a JAXBContext instance
JAXBContext tJaxbContext = JAXBContext.newInstance(pJaxPropertiesFile);
Marshaller tMarshaller = tJaxbContext.createMarshaller();
tMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
FileOutputStream fos = new FileOutputStream("d:/temp/fichier_marshalle.xml", false /* append */ );
BufferedOutputStream bos = new BufferedOutputStream( fos, 4096 /* buffsize */ );
DataOutputStream dos = new DataOutputStream( bos );
OutputStream os = dos;
tMarshaller.marshal( pObject, os );
//3 secondes pour l'execution
dos.flush();
dos.close();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(false);
dbf.setValidating(false);
DocumentBuilder db;
Document doc = null;
db = dbf.newDocumentBuilder();
doc = db.newDocument();
// Generation du flux XML sortant
tMarshaller.marshal(pObject, doc);
//15 secondes pour l'execution
} catch (ParserConfigurationException e) {
throw (e);
} catch (Exception e) {
throw (e);
} |
Partager