mascoptLib.io.graph
Class MGLWriter

java.lang.Object
  extended bymascoptLib.io.graph.MGLWriter
All Implemented Interfaces:
WriterInterface
Direct Known Subclasses:
MGXWriter

public class MGLWriter
extends Object
implements WriterInterface

The MGL Writer.


Constructor Summary
MGLWriter(OutputStream os)
          Creates a writer with a stream.
MGLWriter(String file)
          Creates a writer with a filename.
 
Method Summary
 void add(Object object)
          Add an object to write in the file.
 void write()
          Write the file with all objects added in the Writer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MGLWriter

public MGLWriter(String file)
          throws FileNotFoundException
Creates a writer with a filename.

Parameters:
file - the filename where to write.

MGLWriter

public MGLWriter(OutputStream os)
Creates a writer with a stream.

Parameters:
os - the stream where to write.
Method Detail

add

public void add(Object object)
Description copied from interface: WriterInterface
Add an object to write in the file. This method provides a simple way of write your objects in a file. When the Writer is created you just add your objects and it will be written when calling the write() function. The add may fail if the object you write is not recognize by the file format you use. It will be ignored.

Specified by:
add in interface WriterInterface
Parameters:
object - the object to write in the file.

write

public void write()
Description copied from interface: WriterInterface
Write the file with all objects added in the Writer. This open, then write the file and close it. All recognized objects added with the add() method are written.

Specified by:
write in interface WriterInterface