Package net.ontopia.topicmaps.utils.jtm
Class JTMTopicMapWriter
- java.lang.Object
-
- net.ontopia.topicmaps.utils.jtm.JTMTopicMapWriter
-
- All Implemented Interfaces:
TopicMapWriterIF
public class JTMTopicMapWriter extends Object implements TopicMapWriterIF
PUBLIC: Exports topic maps to the JTM 1.0 interchange format. See the JTM homepage for a specification of the JTM 1.0 exchange format for topic map fragments.- Since:
- 5.1.0
-
-
Constructor Summary
Constructors Constructor Description JTMTopicMapWriter(File file)
PUBLIC: Create an JTMTopicMapWriter that writes to a given File in UTF-8.JTMTopicMapWriter(File file, String encoding)
PUBLIC: Create an JTMTopicMapWriter that writes to a given File in the given encoding.JTMTopicMapWriter(OutputStream stream)
PUBLIC: Create an JTMTopicMapWriter that writes to a given OutputStream in UTF-8.JTMTopicMapWriter(OutputStream stream, String encoding)
PUBLIC: Create an JTMTopicMapWriter that writes to a given OutputStream in the given encoding.JTMTopicMapWriter(Writer out)
PUBLIC: Create an JTMTopicMapWriter that writes to a given Writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setAdditionalProperties(Map<String,Object> properties)
JTMTopicMapWriter has no additional properties.void
write(Collection<TopicIF> topics, Collection<AssociationIF> assocs)
EXPERIMENTAL: Write out a collection of topics and associations as a JTM fragment, represented as a complete topic map.void
write(TMObjectIF object)
PUBLIC: Write the given topic map construct as a JTM fragment.void
write(TopicMapIF tm)
PUBLIC: Writes out the given topic map.
-
-
-
Constructor Detail
-
JTMTopicMapWriter
public JTMTopicMapWriter(File file) throws IOException
PUBLIC: Create an JTMTopicMapWriter that writes to a given File in UTF-8. Warning: Use of this method is discouraged, as it is very easy to get character encoding errors with this method.- Parameters:
file
- Where the output should be written.- Throws:
IOException
-
JTMTopicMapWriter
public JTMTopicMapWriter(File file, String encoding) throws IOException
PUBLIC: Create an JTMTopicMapWriter that writes to a given File in the given encoding.- Parameters:
file
- Where the output should be written.encoding
- The desired character encoding.- Throws:
IOException
-
JTMTopicMapWriter
public JTMTopicMapWriter(OutputStream stream) throws IOException
PUBLIC: Create an JTMTopicMapWriter that writes to a given OutputStream in UTF-8. Warning: Use of this method is discouraged, as it is very easy to get character encoding errors with this method.- Parameters:
stream
- Where the output should be written.- Throws:
IOException
-
JTMTopicMapWriter
public JTMTopicMapWriter(OutputStream stream, String encoding) throws IOException
PUBLIC: Create an JTMTopicMapWriter that writes to a given OutputStream in the given encoding.- Parameters:
stream
- Where the output should be written.encoding
- The desired character encoding.- Throws:
IOException
-
JTMTopicMapWriter
public JTMTopicMapWriter(Writer out)
PUBLIC: Create an JTMTopicMapWriter that writes to a given Writer.- Parameters:
out
- Where the output should be written.
-
-
Method Detail
-
write
public void write(TopicMapIF tm) throws IOException
PUBLIC: Writes out the given topic map.- Specified by:
write
in interfaceTopicMapWriterIF
- Parameters:
tm
- The topic map to be serialized as JTM.- Throws:
IOException
- Thrown if writing the topic map fails.
-
write
public void write(TMObjectIF object) throws IOException
PUBLIC: Write the given topic map construct as a JTM fragment.- Parameters:
object
- The topic map construct to be serialized as JTM fragment.- Throws:
IOException
-
write
public void write(Collection<TopicIF> topics, Collection<AssociationIF> assocs) throws IOException
EXPERIMENTAL: Write out a collection of topics and associations as a JTM fragment, represented as a complete topic map. The identities, names, variants, occurrences, and types of the topics are output, as are the complete associations. Note that the associations of topics in the topics collection are not output, unless they are contained in the assocs collection.- Throws:
IOException
-
setAdditionalProperties
public void setAdditionalProperties(Map<String,Object> properties)
JTMTopicMapWriter has no additional properties.- Specified by:
setAdditionalProperties
in interfaceTopicMapWriterIF
- Parameters:
properties
-
-
-