Class TextDumper

java.lang.Object
edu.pdx.cs410J.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:
  • Constructor Details

    • 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 Details

    • 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.