Class OMXMLWriter

java.lang.Object
java.io.Writer
org.episteme.core.mathematics.loaders.openmath.io.OMXMLWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class OMXMLWriter extends Writer
Implements an outputstream that can write OpenMath objects as XML.

Version:
$Revision: 1.3 $
Author:
Manfred Riem (mriem@manorrock.org)
  • Field Details

    • sOMObjects

      protected static String[] sOMObjects
      Stores a static array with all the OpenMath element-names in use.

    • mPrettyPrint

      protected boolean mPrettyPrint
      Stores if we should pretty-print.

    • printOuterOMOBJ

      protected boolean printOuterOMOBJ
      Stores if we should drop the outer OMOBJ.

    • mPrintWriter

      protected PrintWriter mPrintWriter
      Stores the output-stream.

  • Constructor Details

    • OMXMLWriter

      public OMXMLWriter(Writer fWriter)
      Constructor.

      Parameters:
      fWriter - the writer we actually use to write out.
    • OMXMLWriter

      public OMXMLWriter(Writer fWriter, boolean fPrettyPrint)
      Constructor.

      Parameters:
      fWriter - the writer we actually use to write out.
      fPrettyPrint - sets if we should pretty print the output.
    • OMXMLWriter

      public OMXMLWriter(Writer writer, boolean printPretty, boolean printOuterOMOBJ)
      Constructor.

      Parameters:
      writer - the writer we actually use to write out.
      printPretty - sets if we should pretty print the output.
      printOuterOMOBJ - sets if we should print the outer OMOBJ.
  • Method Details

    • write

      public void write(int fInt) throws IOException
      Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument fInt. The 24 high-order bits of fInt are ignored.

      Overrides:
      write in class Writer
      Parameters:
      fInt - the byte to write.
      Throws:
      IOException - when an I/O exception occurs.
    • close

      public void close() throws IOException
      Close the stream, flushing it first. Once a stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously-closed stream, however, has no effect.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class Writer
      Throws:
      IOException - when an I/O error occurs.
    • write

      public void write(char[] fCharacterBuffer, int fOffset, int fLength) throws IOException
      Write a portion of an array of characters.
      Specified by:
      write in class Writer
      Parameters:
      fCharacterBuffer - the buffer of characters to write.
      fOffset - the offset in the character buffer.
      fLength - the number of characters to write.
      Throws:
      IOException - when an I/O error occurs.
    • flush

      public void flush() throws IOException
      Flush the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.
      Specified by:
      flush in interface Flushable
      Specified by:
      flush in class Writer
      Throws:
      IOException - when an I/O error occurs.
    • writeObject

      public void writeObject(OMObject fObject)
      Write an OMObject.

      Parameters:
      fObject - the OMObject to write out.