net.ontopia.topicmaps.xml
Class CanonicalTopicMapWriter

java.lang.Object
  extended by net.ontopia.topicmaps.xml.CanonicalTopicMapWriter
All Implemented Interfaces:
TopicMapWriterIF

public class CanonicalTopicMapWriter
extends java.lang.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
 class CanonicalTopicMapWriter.CanonicalXTMPrinter
           
 
Field Summary
protected  LocatorIF baseloc
           
protected  org.xml.sax.DocumentHandler out
           
protected  java.io.OutputStream stream
           
 
Constructor Summary
CanonicalTopicMapWriter(java.io.File file)
          Creates a topic map writer bound to the file given in the arguments.
CanonicalTopicMapWriter(java.io.OutputStream stream)
          Creates a topic map writer bound to the output stream given in the arguments.
CanonicalTopicMapWriter(java.lang.String filename)
          Creates a topic map writer bound to the file given in the arguments.
 
Method Summary
 void export(TopicMapIF topicmap, org.xml.sax.DocumentHandler dh)
          PUBLIC: Exports the topic map to the given DocumentHandler.
 LocatorIF getBaseLocator()
          INTERNAL: Gets the base locator used to resolve relative locators.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

protected org.xml.sax.DocumentHandler out

stream

protected java.io.OutputStream stream

baseloc

protected LocatorIF baseloc
Constructor Detail

CanonicalTopicMapWriter

public CanonicalTopicMapWriter(java.lang.String filename)
                        throws java.io.IOException
Creates a topic map writer bound to the file given in the arguments.

Parameters:
filename - The name of the file to which the topic map is to be written.
Throws:
java.io.IOException

CanonicalTopicMapWriter

public CanonicalTopicMapWriter(java.io.File file)
                        throws java.io.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:
java.io.IOException

CanonicalTopicMapWriter

public CanonicalTopicMapWriter(java.io.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 java.io.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 interface TopicMapWriterIF
Parameters:
topicmap - The topic map to be exported/written; an object implementing TopicMapIF
Throws:
java.io.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,
                   org.xml.sax.DocumentHandler dh)
            throws java.io.IOException,
                   org.xml.sax.SAXException
PUBLIC: Exports the topic map to the given DocumentHandler.

Throws:
java.io.IOException
org.xml.sax.SAXException


Copyright © 2000-2012 Ontopia.