edu.pdx.cs399J.family
Class TextDumper

java.lang.Object
  extended by edu.pdx.cs399J.family.TextDumper
All Implemented Interfaces:
Dumper

public class TextDumper
extends Object
implements Dumper

This class dumps a family tree to a destination (for example, a file) in a text-based format that is meant to be parsed by a TextParser. It is not necessarily human-readable.

Author:
David Whitlock
See Also:
TextParser

Constructor Summary
TextDumper(File file)
          Creates a new text dumper that dumps to a given file.
TextDumper(PrintWriter pw)
          Creates a new text dumper that prints to a PrintWriter.
TextDumper(String fileName)
          Creates a new text dumper that dumps to a file of a given name.
 
Method Summary
 void dump(FamilyTree tree)
          Dumps the contents of a family tree to the desired desitination.
static void main(String[] args)
          Test program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextDumper

public TextDumper(String fileName)
           throws IOException
Creates a new text dumper that dumps to a file of a given name. If the file does not exist, it is created.

Throws:
IOException

TextDumper

public TextDumper(File file)
           throws IOException
Creates a new text dumper that dumps to a given file.

Throws:
IOException

TextDumper

public TextDumper(PrintWriter pw)
Creates a new text dumper that prints to a PrintWriter. This way, we can dump to destinations other than files.

Method Detail

dump

public void dump(FamilyTree tree)
Dumps the contents of a family tree to the desired desitination.

Specified by:
dump in interface Dumper

main

public static void main(String[] args)
Test program. Create a simple family tree and dump it to the file specified by the first argument.



Copyright © 2000-2009 Portland State University. All Rights Reserved.