@Test public void testOutputStream() throws IOException { String baseline = TestFileUtils.getTestInputFile(testdataDirectory, "baseline", "outputstream.cxtm"); File out = TestFileUtils.getTestOutputFile(testdataDirectory, "out", "outputstream.cxtm"); FileOutputStream outs = new FileOutputStream(out); new CanonicalXTMWriter(outs).write(topicmap); outs.close(); Assert.assertTrue("OutputStream export gives incorrect output", TestFileUtils.compareFileToResource(out, baseline)); }
@Override public void write(TopicMapIF topicmap) { DuplicateSuppressionUtils.removeDuplicates(topicmap); tmForFake = topicmap; base = topicmap.getStore().getBaseAddress().getAddress(); strippedBase = stripLocator(base); Object[] topics = getTopics(topicmap); Object[] associations = getAssociations(topicmap); recordIndexes(topics, associations); out.startDocument(); startElement(EL_TOPICMAP, reifier(topicmap)); writeLocators(topicmap.getItemIdentifiers(), EL_ITEMIDENTIFIERS); for (int ix = 0; ix < topics.length; ix++) write((TopicIF) topics[ix]); for (int ix = 0; ix < associations.length; ix++) write((AssociationIF) associations[ix], ix + 1); endElement(EL_TOPICMAP); out.endDocument(); }
CanonicalXTMWriter implements TopicMapWriterIF { @Override public void write(TopicMapIF topicmap) { DuplicateSuppressionUtils.removeDuplicates(topicmap); tmForFake = topicmap; base = topicmap.getStore().getBaseAddress().getAddress(); strippedBase = stripLocator(base); Object[] topics = getTopics(topicmap); Object[] associations = getAssociations(topicmap); recordIndexes(topics, associations); out.startDocument(); startElement(EL_TOPICMAP, reifier(topicmap)); writeLocators(topicmap.getItemIdentifiers(), EL_ITEMIDENTIFIERS); for (int ix = 0; ix < topics.length; ix++) write((TopicIF) topics[ix]); for (int ix = 0; ix < associations.length; ix++) write((AssociationIF) associations[ix], ix + 1); endElement(EL_TOPICMAP); out.endDocument(); } }
CanonicalXTMWriter implements TopicMapWriterIF { @Override public void write(TopicMapIF topicmap) { DuplicateSuppressionUtils.removeDuplicates(topicmap); tmForFake = topicmap; base = topicmap.getStore().getBaseAddress().getAddress(); strippedBase = stripLocator(base); Object[] topics = getTopics(topicmap); Object[] associations = getAssociations(topicmap); recordIndexes(topics, associations); out.startDocument(); startElement(EL_TOPICMAP, reifier(topicmap)); writeLocators(topicmap.getItemIdentifiers(), EL_ITEMIDENTIFIERS); for (int ix = 0; ix < topics.length; ix++) write((TopicIF) topics[ix]); for (int ix = 0; ix < associations.length; ix++) write((AssociationIF) associations[ix], ix + 1); endElement(EL_TOPICMAP); out.endDocument(); } CanonicalXTMWriter(File file);  CanonicalXTMWriter(OutputStream out);  CanonicalXTMWriter(Writer out); }
CanonicalXTMWriter implements TopicMapWriterIF { @Override public void write(TopicMapIF topicmap) { DuplicateSuppressionUtils.removeDuplicates(topicmap); tmForFake = topicmap; base = topicmap.getStore().getBaseAddress().getAddress(); strippedBase = stripLocator(base); Object[] topics = getTopics(topicmap); Object[] associations = getAssociations(topicmap); recordIndexes(topics, associations); out.startDocument(); startElement(EL_TOPICMAP, reifier(topicmap)); writeLocators(topicmap.getItemIdentifiers(), EL_ITEMIDENTIFIERS); for (int ix = 0; ix < topics.length; ix++) write((TopicIF) topics[ix]); for (int ix = 0; ix < associations.length; ix++) write((AssociationIF) associations[ix], ix + 1); endElement(EL_TOPICMAP); out.endDocument(); } CanonicalXTMWriter(File file);  CanonicalXTMWriter(OutputStream out);  CanonicalXTMWriter(Writer out); @Override void write(TopicMapIF topicmap); @Override void setAdditionalProperties(Map<String, Object> properties); }
CanonicalXTMWriter implements TopicMapWriterIF { @Override public void write(TopicMapIF topicmap) { DuplicateSuppressionUtils.removeDuplicates(topicmap); tmForFake = topicmap; base = topicmap.getStore().getBaseAddress().getAddress(); strippedBase = stripLocator(base); Object[] topics = getTopics(topicmap); Object[] associations = getAssociations(topicmap); recordIndexes(topics, associations); out.startDocument(); startElement(EL_TOPICMAP, reifier(topicmap)); writeLocators(topicmap.getItemIdentifiers(), EL_ITEMIDENTIFIERS); for (int ix = 0; ix < topics.length; ix++) write((TopicIF) topics[ix]); for (int ix = 0; ix < associations.length; ix++) write((AssociationIF) associations[ix], ix + 1); endElement(EL_TOPICMAP); out.endDocument(); } CanonicalXTMWriter(File file);  CanonicalXTMWriter(OutputStream out);  CanonicalXTMWriter(Writer out); @Override void write(TopicMapIF topicmap); @Override void setAdditionalProperties(Map<String, Object> properties);  }