Filtering, Mangling, and Munging

A filter reads from one file and writes to another.

A mangler re-writes a file (nice manglers make backups).

A munger mangles all the files in a directory and its sub-directories.

import java.io.*;

public class HTMLizer {
    HTMLizer(String name) throws IOException {
        reader = new BufferedReader(name + ".java");
        writer = new PrintWriter(name + ".html");

        String line;
        while ((line = reader.readLine()) != null) {
            line = process(line);
            writer.println(line);
       }

        writer.close();
        reader.close();
    }
}
        bakFile = new File(fileName + ".bak");
        inFile.renameTo(bakFile);
        outFile = inFile;
        inFile  = bakFile;
public void recurse(File dir) {
    File[] dirs = getSubDirectories(dir);
    for (int i = 0; i < dirs.length; i++) {
        recurse(dirs[i]);
    }

    File[] files = getFilesIn(dir);
    for (int i = 0; i < files.length; i++) {
        munge(files[i]);
    }
}