org.deepfs.util
Class TreePrinter

java.lang.Object
  extended by org.deepfs.util.TreePrinter
All Implemented Interfaces:
FSTraversal

public final class TreePrinter
extends Object
implements FSTraversal

Produces tree(1)-like output of a directory hierarchy.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Alexander Holupirek

Constructor Summary
TreePrinter()
           
 
Method Summary
 void levelUpdate(int l)
          Event triggered once tree level has changed.
 void postDirectoryVisit(File d)
          Nothing is done when a directory is left.
 void postTraversalVisit(File d)
          Nothing special is done when the traversal is finished.
 void preDirectoryVisit(File d)
          Prints a line for tree(1)-like output of a directory.
 void preTraversalVisit(File d)
          Prints absolute path of directory to be visited subsequently.
 void regularFileVisit(File f)
          Prints a line for tree(1)-like output of a regular file.
 void symLinkVisit(File f)
          Prints a line for tree(1)-like output of a symbolic link.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreePrinter

public TreePrinter()
Method Detail

preDirectoryVisit

public void preDirectoryVisit(File d)
Prints a line for tree(1)-like output of a directory. The line contains an indentation prefix and the name of the directory and is printed whenever a directory is entered during a filesystem traversal.

Specified by:
preDirectoryVisit in interface FSTraversal
Parameters:
d - the directory node

postDirectoryVisit

public void postDirectoryVisit(File d)
Nothing is done when a directory is left. This method contains no code.

Specified by:
postDirectoryVisit in interface FSTraversal
Parameters:
d - the directory node

regularFileVisit

public void regularFileVisit(File f)
Prints a line for tree(1)-like output of a regular file. The line contains an indentation prefix and the name of the file. It is printed whenever a regular file is visited during a filesystem traversal.

Specified by:
regularFileVisit in interface FSTraversal
Parameters:
f - the file

symLinkVisit

public void symLinkVisit(File f)
Prints a line for tree(1)-like output of a symbolic link. The line contains an indentation prefix and the name of the link. It is printed whenever a symbolic link is visited during a filesystem traversal. The traversal will not follow the link.

Specified by:
symLinkVisit in interface FSTraversal
Parameters:
f - the file

preTraversalVisit

public void preTraversalVisit(File d)
Prints absolute path of directory to be visited subsequently.

Specified by:
preTraversalVisit in interface FSTraversal
Parameters:
d - directory the traversal starts from

postTraversalVisit

public void postTraversalVisit(File d)
Nothing special is done when the traversal is finished. This method contains no code.

Specified by:
postTraversalVisit in interface FSTraversal
Parameters:
d - the directory node the traversal started from

levelUpdate

public void levelUpdate(int l)
Description copied from interface: FSTraversal
Event triggered once tree level has changed.

Specified by:
levelUpdate in interface FSTraversal
Parameters:
l - relative level/depth of traversal in directory hierarchy