nl.tue.win.riaca.openmath.io
Class OMXMLWriter

java.lang.Object
  extended byjava.io.Writer
      extended bynl.tue.win.riaca.openmath.io.OMXMLWriter

public class OMXMLWriter
extends java.io.Writer

Implements an outputstream that can write OpenMath objects as XML.

Version:
$Revision: 1.25 $
Author:
Manfred Riem (mriem@manorrock.org)

Field Summary
protected  boolean mPrettyPrint
          Stores if we should pretty-print.
protected  java.io.PrintWriter mPrintWriter
          Stores the output-stream.
protected  boolean printOuterOMOBJ
          Stores if we should drop the outer OMOBJ.
protected static java.lang.String[] sOMObjects
          Stores a static array with all the OpenMath element-names in use.
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
OMXMLWriter(java.io.Writer fWriter)
          Constructor.
OMXMLWriter(java.io.Writer fWriter, boolean fPrettyPrint)
          Constructor.
OMXMLWriter(java.io.Writer writer, boolean printPretty, boolean printOuterOMOBJ)
          Constructor.
 
Method Summary
 void close()
          Close the stream, flushing it first.
 void flush()
          Flush the stream.
 void write(char[] fCharacterBuffer, int fOffset, int fLength)
          Write a portion of an array of characters.
 void write(int fInt)
          Writes the specified byte to this output stream.
 void writeObject(OMObject fObject)
          Write an OMObject.
 
Methods inherited from class java.io.Writer
write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sOMObjects

protected static java.lang.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 java.io.PrintWriter mPrintWriter
Stores the output-stream.

Constructor Detail

OMXMLWriter

public OMXMLWriter(java.io.Writer fWriter)
Constructor.

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

OMXMLWriter

public OMXMLWriter(java.io.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(java.io.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 Detail

write

public void write(int fInt)
           throws java.io.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.

Parameters:
fInt - the byte to write.
Throws:
java.io.IOException - when an I/O exception occurs.

close

public void close()
           throws java.io.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.

Throws:
java.io.IOException - when an I/O error occurs.

write

public void write(char[] fCharacterBuffer,
                  int fOffset,
                  int fLength)
           throws java.io.IOException
Write a portion of an array of characters.

Parameters:
fCharacterBuffer - the buffer of characters to write.
fOffset - the offset in the character buffer.
fLength - the number of characters to write.
Throws:
java.io.IOException - when an I/O error occurs.

flush

public void flush()
           throws java.io.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.

Throws:
java.io.IOException - when an I/O error occurs.

writeObject

public void writeObject(OMObject fObject)
Write an OMObject.

Parameters:
fObject - the OMObject to write out.


Copyright © 2001-2004 RIACA, Technische Universiteit Eindhoven. All Rights Reserved.