Sha256: 6549c26b604efc0d4ea62520c7cfa4ce84831501d4b7825a4bb650e56293e3ca
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 module RTM::IO # Import and Export of TMAPI Topic Maps # Utilizing the Ontopia libary http://code.google.com/p/tmapix/ # Consequently the (de-) serializer provided here # are only Wrapper module Ontopia module TopicMap def to_cxtm(file=nil) raise("Only supported for Ontopia.") unless self.kind_of?(Java::NetOntopiaTopicmapsImplTmapi2::TopicMapImpl) if file if file.is_a?(java.io.OutputStream) out_stream = file else out_stream = java.io.BufferedOutputStream.new(java.io.FileOutputStream.new(file)) end else # if no file was given we want to return a string which will be written into a stream by the writer out_stream = java.io.ByteArrayOutputStream.new end writer = Java::NetOntopiaTopicmapsXml::CanonicalXTMWriter.new(out_stream) writer.write(self.wrapped) out_stream.flush # close the file unless we were provided with a stream out_stream.close unless file && file.is_a?(java.io.OutputStream) # if there was no file, we have a ByteArrayOutputStream. Get the String out of it (and return it) out_stream.to_s unless file end end RTM.register_extension(self) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rtm-ontopia-0.3.1-java | lib/rtm/ontopia/io/to_cxtm.rb |
rtm-ontopia-0.3.0 | lib/rtm/ontopia/io/to_cxtm.rb |