@Test public void test() throws FileNotFoundException { ModelIndex modelIndex = new DefaultModelIndex(XmiReader.readModel(XMI_FILE)); Documentation<Type> documentation = DocumentationReader.readDocumentation(DOMAIN_FILE, modelIndex); DocumentationWriter.writeDocument(documentation, modelIndex, OUTPUT_FILENAME1); DocumentationWriter.writeDocument(documentation, modelIndex, new File(OUTPUT_FILENAME2)); File outputFile1 = new File(OUTPUT_FILENAME1); File outputFile2 = new File(OUTPUT_FILENAME2); assertTrue(outputFile1.exists()); if (!outputFile2.exists()) { outputFile1.delete(); fail(); } long outputFile1Length = outputFile1.length(); long outputFile2Length = outputFile2.length(); outputFile1.delete(); outputFile2.delete(); assertTrue(outputFile1Length == outputFile2Length); }
public static final void writeDocument(final Documentation<Type> documentation, final ModelIndex model, final OutputStream outstream) { if (outstream == null) { throw new IllegalArgumentException("outstream"); } final XMLOutputFactory xof = XMLOutputFactory.newInstance(); try { final XMLStreamWriter xsw = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(outstream, "UTF-8")); xsw.writeStartDocument("UTF-8", "1.0"); try { writeRoot(documentation, model, xsw); } finally { xsw.writeEndDocument(); } xsw.flush(); xsw.close(); } catch (final XMLStreamException e) { throw new DocumentGeneratorRuntimeException(e); } }
DocumentationWriter { public static final void writeDocument(final Documentation<Type> documentation, final ModelIndex model, final OutputStream outstream) { if (outstream == null) { throw new IllegalArgumentException("outstream"); } final XMLOutputFactory xof = XMLOutputFactory.newInstance(); try { final XMLStreamWriter xsw = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(outstream, "UTF-8")); xsw.writeStartDocument("UTF-8", "1.0"); try { writeRoot(documentation, model, xsw); } finally { xsw.writeEndDocument(); } xsw.flush(); xsw.close(); } catch (final XMLStreamException e) { throw new DocumentGeneratorRuntimeException(e); } } }
DocumentationWriter { public static final void writeDocument(final Documentation<Type> documentation, final ModelIndex model, final OutputStream outstream) { if (outstream == null) { throw new IllegalArgumentException("outstream"); } final XMLOutputFactory xof = XMLOutputFactory.newInstance(); try { final XMLStreamWriter xsw = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(outstream, "UTF-8")); xsw.writeStartDocument("UTF-8", "1.0"); try { writeRoot(documentation, model, xsw); } finally { xsw.writeEndDocument(); } xsw.flush(); xsw.close(); } catch (final XMLStreamException e) { throw new DocumentGeneratorRuntimeException(e); } } DocumentationWriter(); }
DocumentationWriter { public static final void writeDocument(final Documentation<Type> documentation, final ModelIndex model, final OutputStream outstream) { if (outstream == null) { throw new IllegalArgumentException("outstream"); } final XMLOutputFactory xof = XMLOutputFactory.newInstance(); try { final XMLStreamWriter xsw = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(outstream, "UTF-8")); xsw.writeStartDocument("UTF-8", "1.0"); try { writeRoot(documentation, model, xsw); } finally { xsw.writeEndDocument(); } xsw.flush(); xsw.close(); } catch (final XMLStreamException e) { throw new DocumentGeneratorRuntimeException(e); } } DocumentationWriter(); static final void writeDocument(final Documentation<Type> documentation, final ModelIndex model,
            final OutputStream outstream); static final void writeDocument(final Documentation<Type> documentation, final ModelIndex model,
            final String fileName); static final void writeDocument(final Documentation<Type> documentation, final ModelIndex model,
            final File file); }
DocumentationWriter { public static final void writeDocument(final Documentation<Type> documentation, final ModelIndex model, final OutputStream outstream) { if (outstream == null) { throw new IllegalArgumentException("outstream"); } final XMLOutputFactory xof = XMLOutputFactory.newInstance(); try { final XMLStreamWriter xsw = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(outstream, "UTF-8")); xsw.writeStartDocument("UTF-8", "1.0"); try { writeRoot(documentation, model, xsw); } finally { xsw.writeEndDocument(); } xsw.flush(); xsw.close(); } catch (final XMLStreamException e) { throw new DocumentGeneratorRuntimeException(e); } } DocumentationWriter(); static final void writeDocument(final Documentation<Type> documentation, final ModelIndex model,
            final OutputStream outstream); static final void writeDocument(final Documentation<Type> documentation, final ModelIndex model,
            final String fileName); static final void writeDocument(final Documentation<Type> documentation, final ModelIndex model,
            final File file);  }