Class OMXMLWriter
java.lang.Object
java.io.Writer
org.episteme.core.mathematics.loaders.openmath.io.OMXMLWriter
- All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable
Implements an outputstream that can write OpenMath objects as XML.
- Version:
- $Revision: 1.3 $
- Author:
- Manfred Riem (mriem@manorrock.org)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanStores if we should pretty-print.protected PrintWriterStores the output-stream.protected booleanStores if we should drop the outer OMOBJ.protected static String[]Stores a static array with all the OpenMath element-names in use. -
Constructor Summary
ConstructorsConstructorDescriptionOMXMLWriter(Writer fWriter) Constructor.OMXMLWriter(Writer fWriter, boolean fPrettyPrint) Constructor.OMXMLWriter(Writer writer, boolean printPretty, boolean printOuterOMOBJ) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the stream, flushing it first.voidflush()Flush the stream.voidwrite(char[] fCharacterBuffer, int fOffset, int fLength) Write a portion of an array of characters.voidwrite(int fInt) Writes the specified byte to this output stream.voidwriteObject(OMObject fObject) Write an OMObject.
-
Field Details
-
sOMObjects
Stores a static array with all the OpenMath element-names in use. -
mPrettyPrint
protected boolean mPrettyPrintStores if we should pretty-print. -
printOuterOMOBJ
protected boolean printOuterOMOBJStores if we should drop the outer OMOBJ. -
mPrintWriter
Stores the output-stream.
-
-
Constructor Details
-
OMXMLWriter
Constructor.- Parameters:
fWriter- the writer we actually use to write out.
-
OMXMLWriter
Constructor.- Parameters:
fWriter- the writer we actually use to write out.fPrettyPrint- sets if we should pretty print the output.
-
OMXMLWriter
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
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:
writein classWriter- Parameters:
fInt- the byte to write.- Throws:
IOException- when an I/O exception occurs.
-
close
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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException- when an I/O error occurs.
-
write
Write a portion of an array of characters.- Specified by:
writein classWriter- 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
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:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException- when an I/O error occurs.
-
writeObject
Write an OMObject.- Parameters:
fObject- the OMObject to write out.
-