List of usage examples for org.apache.commons.io.output NullOutputStream nullOutputStream
public static OutputStream nullOutputStream()
From source file:org.olat.upgrade.OLATUpgrade_9_0_0.java
private long checksum(byte[] binaryDatas) throws IOException { InputStream in = null;/*w w w. ja v a 2s . c o m*/ Adler32 checksum = new Adler32(); try { in = new CheckedInputStream(new ByteArrayInputStream(binaryDatas), checksum); IOUtils.copy(in, new NullOutputStream()); } finally { IOUtils.closeQuietly(in); } return checksum.getValue(); }
From source file:org.openestate.io.examples.CasaItWritingExample.java
/** * Start the example application./*from www. ja va 2s . com*/ * * @param args * command line arguments */ public static void main(String[] args) { // init logging PropertyConfigurator.configure(CasaItWritingExample.class.getResource(PACKAGE + "/log4j.properties")); // create a Container object with some example data // this object corresponds to the <container> root element in XML Container container = FACTORY.createContainer(); container.setRealestateitems(FACTORY.createContainerRealestateitems()); // append some example objects to the Container object container.getRealestateitems().getRealestate().add(createRealestate()); container.getRealestateitems().getRealestate().add(createRealestate()); container.getRealestateitems().getRealestate().add(createRealestate()); // convert the Container object into a XML document CasaItDocument doc = null; try { doc = CasaItDocument.newDocument(container); } catch (Exception ex) { LOGGER.error("Can't create XML document!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.File try { write(doc, File.createTempFile("output-", ".xml")); } catch (IOException ex) { LOGGER.error("Can't create temporary file!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.OutputStream write(doc, new NullOutputStream()); // write XML document into a java.io.Writer write(doc, new NullWriter()); // write XML document into a string and send it to the console writeToConsole(doc); }
From source file:org.openestate.io.examples.DaftIeWritingExample.java
/** * Start the example application./*from ww w .ja v a 2s . c o m*/ * * @param args * command line arguments */ public static void main(String[] args) { // init logging PropertyConfigurator.configure(DaftIeWritingExample.class.getResource(PACKAGE + "/log4j.properties")); // create a Daft object with some example data // this object corresponds to the <daft> root element in XML Daft daft = FACTORY.createDaft(); // append some example objectss for rent to the Daft object daft.setOverseasRental(FACTORY.createDaftOverseasRental()); daft.getOverseasRental().getOverseasRentalAd().add(createAdForRent()); daft.getOverseasRental().getOverseasRentalAd().add(createAdForRent()); // append some example objectss for sale to the Daft object daft.setOverseasSales(FACTORY.createDaftOverseasSales()); daft.getOverseasSales().getOverseasSaleAd().add(createAdForSale()); daft.getOverseasSales().getOverseasSaleAd().add(createAdForSale()); daft.getOverseasSales().getOverseasSaleAd().add(createAdForSale()); // convert the Daft object into a XML document DaftIeDocument doc = null; try { doc = DaftIeDocument.newDocument(daft); } catch (Exception ex) { LOGGER.error("Can't create XML document!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.File try { write(doc, File.createTempFile("output-", ".xml")); } catch (IOException ex) { LOGGER.error("Can't create temporary file!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.OutputStream write(doc, new NullOutputStream()); // write XML document into a java.io.Writer write(doc, new NullWriter()); // write XML document into a string and send it to the console writeToConsole(doc); }
From source file:org.openestate.io.examples.FilemakerWritingExample.java
/** * Start the example application./*from www. j a va 2s . c om*/ * * @param args * command line arguments */ public static void main(String[] args) { // init logging PropertyConfigurator.configure(FilemakerWritingExample.class.getResource(PACKAGE + "/log4j.properties")); // create a FMPXMLRESULT object with some example data // this object corresponds to the <FMPXMLRESULT> root element in XML FMPXMLRESULT result = FACTORY.createFMPXMLRESULT(); result.setERRORCODE("0"); result.setPRODUCT(createProduct()); result.setDATABASE(createDatabase()); result.setMETADATA(createMetaData()); result.setRESULTSET(createResultSet()); // convert the Openimmo object into a XML document FilemakerResultDocument doc = null; try { doc = FilemakerResultDocument.newDocument(result); } catch (Exception ex) { LOGGER.error("Can't create XML document!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.File try { write(doc, File.createTempFile("output-", ".xml")); } catch (IOException ex) { LOGGER.error("Can't create temporary file!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.OutputStream write(doc, new NullOutputStream()); // write XML document into a java.io.Writer write(doc, new NullWriter()); // write XML document into a string and send it to the console writeToConsole(doc); }
From source file:org.openestate.io.examples.IdxWritingExample.java
/** * Start the example application.//from w w w . j ava 2 s . co m * * @param args * command line arguments */ public static void main(String[] args) { // init logging PropertyConfigurator.configure(IdxWritingExample.class.getResource(PACKAGE + "/log4j.properties")); // create some CSV records List<IdxRecord> records = new ArrayList<IdxRecord>(); records.add(createRecord()); records.add(createRecord()); records.add(createRecord()); records.add(createRecord()); // write CSV records into a java.io.File try { write(records, File.createTempFile("output-", ".csv")); } catch (IOException ex) { LOGGER.error("Can't create temporary file!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write CSV records into a java.io.OutputStream write(records, new NullOutputStream()); // write CSV records into a java.io.Writer write(records, new NullWriter()); // write CSV records into a string and send it to the console writeToConsole(records); }
From source file:org.openestate.io.examples.ImmobiliareItWritingExample.java
/** * Start the example application./*from ww w. j a v a 2 s .co m*/ * * @param args * command line arguments */ public static void main(String[] args) { // init logging PropertyConfigurator .configure(ImmobiliareItWritingExample.class.getResource(PACKAGE + "/log4j.properties")); // create a Feed object with some example data // this object corresponds to the <feed> root element in XML Feed feed = FACTORY.createFeed(); // append some example objects to the Feed object feed.setProperties(FACTORY.createFeedProperties()); feed.getProperties().getProperty().add(createProperty()); feed.getProperties().getProperty().add(createProperty()); // convert the Feed object into a XML document ImmobiliareItDocument doc = null; try { doc = ImmobiliareItDocument.newDocument(feed); } catch (Exception ex) { LOGGER.error("Can't create XML document!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.File try { write(doc, File.createTempFile("output-", ".xml")); } catch (IOException ex) { LOGGER.error("Can't create temporary file!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.OutputStream write(doc, new NullOutputStream()); // write XML document into a java.io.Writer write(doc, new NullWriter()); // write XML document into a string and send it to the console writeToConsole(doc); }
From source file:org.openestate.io.examples.ImmoXmlWritingExample.java
/** * Start the example application./* w w w . j a v a 2s.c o m*/ * * @param args * command line arguments */ public static void main(String[] args) { // init logging PropertyConfigurator.configure(ImmoXmlWritingExample.class.getResource(PACKAGE + "/log4j.properties")); // create an Immoxml object with some example data // this object corresponds to the <immoxml> root element in XML Immoxml immoxml = FACTORY.createImmoxml(); immoxml.setUebertragung(createUebertragung()); immoxml.getAnbieter().add(createAnbieter()); // convert the Immoxml object into a XML document ImmoXmlDocument doc = null; try { doc = ImmoXmlDocument.newDocument(immoxml); } catch (Exception ex) { LOGGER.error("Can't create XML document!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.File try { write(doc, File.createTempFile("output-", ".xml")); } catch (IOException ex) { LOGGER.error("Can't create temporary file!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.OutputStream write(doc, new NullOutputStream()); // write XML document into a java.io.Writer write(doc, new NullWriter()); // write XML document into a string and send it to the console writeToConsole(doc); }
From source file:org.openestate.io.examples.Is24CsvWritingExample.java
/** * Start the example application.//from w w w.ja v a2 s . c om * * @param args * command line arguments */ public static void main(String[] args) { // init logging PropertyConfigurator.configure(Is24CsvWritingExample.class.getResource(PACKAGE + "/log4j.properties")); // create some CSV records List<Is24CsvRecord> records = new ArrayList<Is24CsvRecord>(); records.add(createHausKaufRecord()); records.add(createHausKaufRecord()); records.add(createWohnungMieteRecord()); records.add(createWohnungMieteRecord()); // write CSV records into a java.io.File try { write(records, File.createTempFile("output-", ".csv")); } catch (IOException ex) { LOGGER.error("Can't create temporary file!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write CSV records into a java.io.OutputStream write(records, new NullOutputStream()); // write CSV records into a java.io.Writer write(records, new NullWriter()); // write CSV records into a string and send it to the console writeToConsole(records); }
From source file:org.openestate.io.examples.Is24XmlWritingExample.java
/** * Start the example application.// w w w .jav a 2 s .co m * * @param args * command line arguments */ public static void main(String[] args) { // init logging PropertyConfigurator.configure(Is24XmlWritingExample.class.getResource(PACKAGE + "/log4j.properties")); // create a ImmobilienTransferTyp object with some example data // this object corresponds to the <IS24ImmobilienTransfer> root element in XML ImmobilienTransferTyp transfer = FACTORY.createImmobilienTransferTyp(); transfer.setEmailBeiFehler("test@test.org"); transfer.setErstellerSoftware("OpenEstate-IO"); transfer.setErstellerSoftwareVersion("1.1"); transfer.setAnbieter(createAnbieter()); // convert the ImmobilienTransferTyp object into a XML document Is24XmlDocument doc = null; try { doc = Is24XmlDocument.newDocument(transfer); } catch (Exception ex) { LOGGER.error("Can't create XML document!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.File try { write(doc, File.createTempFile("output-", ".xml")); } catch (IOException ex) { LOGGER.error("Can't create temporary file!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.OutputStream write(doc, new NullOutputStream()); // write XML document into a java.io.Writer write(doc, new NullWriter()); // write XML document into a string and send it to the console writeToConsole(doc); }
From source file:org.openestate.io.examples.KyeroWritingExample.java
/** * Start the example application.//from www . j av a2 s .co m * * @param args * command line arguments */ public static void main(String[] args) { // init logging PropertyConfigurator.configure(KyeroWritingExample.class.getResource(PACKAGE + "/log4j.properties")); // create a Root object with some example data // this object corresponds to the <root> element in XML Root root = FACTORY.createRoot(); root.setKyero(createKyero()); root.setAgent(createAgent()); root.getProperty().add(createProperty()); root.getProperty().add(createProperty()); root.getProperty().add(createProperty()); // convert the Root object into a XML document KyeroDocument doc = null; try { doc = KyeroDocument.newDocument(root); } catch (Exception ex) { LOGGER.error("Can't create XML document!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.File try { write(doc, File.createTempFile("output-", ".xml")); } catch (IOException ex) { LOGGER.error("Can't create temporary file!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); System.exit(1); } // write XML document into a java.io.OutputStream write(doc, new NullOutputStream()); // write XML document into a java.io.Writer write(doc, new NullWriter()); // write XML document into a string and send it to the console writeToConsole(doc); // downgrade XML document to an earlier version // and write it to the console doc.downgrade(KyeroVersion.V2_1); writeToConsole(doc); }