Package net.ontopia.topicmaps.xml
Class CanonicalTopicMapWriter
- java.lang.Object
-
- net.ontopia.topicmaps.xml.CanonicalTopicMapWriter
-
- All Implemented Interfaces:
TopicMapWriterIF
public class CanonicalTopicMapWriter extends Object implements TopicMapWriterIF
PUBLIC: A topic map writer that writes topic maps out to Ontopia's Canonical XTM topic map format. This format is generally used for testing and not for other purposes.Note: this is the format defined in an Ontopia technical report, not the upcoming standard format. For new code, please use the standard format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CanonicalTopicMapWriter.CanonicalXTMPrinter
-
Field Summary
Fields Modifier and Type Field Description protected LocatorIF
baseloc
protected ContentHandler
out
-
Constructor Summary
Constructors Constructor Description CanonicalTopicMapWriter(File file)
Creates a topic map writer bound to the file given in the arguments.CanonicalTopicMapWriter(OutputStream stream)
Creates a topic map writer bound to the output stream given in the arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
export(TopicMapIF topicmap, ContentHandler dh)
PUBLIC: Exports the topic map to the given ContentHandler.LocatorIF
getBaseLocator()
INTERNAL: Gets the base locator used to resolve relative locators.void
setAdditionalProperties(Map<String,Object> properties)
CanonicalTopicMapWriter has no additional properties.void
setBaseLocator(LocatorIF baseloc)
INTERNAL: Sets the base locator used to resolve relative locators.void
write(TopicMapIF topicmap)
PUBLIC: Writes the given topic map to an implicit implementation dependent destination.
-
-
-
Field Detail
-
out
protected ContentHandler out
-
baseloc
protected LocatorIF baseloc
-
-
Constructor Detail
-
CanonicalTopicMapWriter
public CanonicalTopicMapWriter(File file) throws IOException
Creates a topic map writer bound to the file given in the arguments.- Parameters:
file
- The file object to which the topic map is to be written.- Throws:
IOException
-
CanonicalTopicMapWriter
public CanonicalTopicMapWriter(OutputStream stream)
Creates a topic map writer bound to the output stream given in the arguments.- Parameters:
stream
- The output stream to which the topic map is to be written.
-
-
Method Detail
-
write
public void write(TopicMapIF topicmap) throws IOException
Description copied from interface:TopicMapWriterIF
PUBLIC: Writes the given topic map to an implicit implementation dependent destination. The write method will close any resources opened internally. This means that the write method can only be called once if the stream/writer was opened internally.- Specified by:
write
in interfaceTopicMapWriterIF
- Parameters:
topicmap
- The topic map to be exported/written; an object implementing TopicMapIF- Throws:
IOException
- Thrown if writing the topic map fails.
-
getBaseLocator
public LocatorIF getBaseLocator()
INTERNAL: Gets the base locator used to resolve relative locators.
-
setBaseLocator
public void setBaseLocator(LocatorIF baseloc)
INTERNAL: Sets the base locator used to resolve relative locators.
-
export
public void export(TopicMapIF topicmap, ContentHandler dh) throws IOException, SAXException
PUBLIC: Exports the topic map to the given ContentHandler.- Throws:
IOException
SAXException
-
setAdditionalProperties
public void setAdditionalProperties(Map<String,Object> properties)
CanonicalTopicMapWriter has no additional properties.- Specified by:
setAdditionalProperties
in interfaceTopicMapWriterIF
- Parameters:
properties
-
-
-