mark.core.files
Class Util

java.lang.Object
  |
  +--mark.core.files.Util

public class Util
extends java.lang.Object

Util is a class that contains a number of simple static utility methods.


Constructor Summary
Util()
           
 
Method Summary
static void addFile(java.lang.String file, java.io.FileFilter ff, boolean recursive, boolean includeInvisible, boolean includeDirs, boolean includeFiles, java.util.Collection to)
          Given a filename and a collection, performs a number of tests on the file, and if the file passes all of the tests, adds a java.io.File java.io.File object corresponding to the filename to the collection.
static void addFiles(java.util.Collection from, java.io.FileFilter ff, boolean recursive, boolean includeInvisible, boolean includeDirs, boolean includeFiles, java.util.Collection to)
          Calls addFile on each filename in the given collection.
static void addFiles(java.lang.String[] from, java.io.FileFilter ff, boolean recursive, boolean includeInvisible, boolean includeDirs, boolean includeFiles, java.util.Collection to)
          Calls addFile on each filename in the given array.
static void process(java.util.Collection c, FileProcessor fp, boolean display)
          Process each file in the given collection with the given FileProcessor.
static void toFile(java.lang.String s, java.lang.String f)
          Outputs the given sting to a file with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

toFile

public static void toFile(java.lang.String s,
                          java.lang.String f)
                   throws java.lang.Exception
Outputs the given sting to a file with the given name.

Parameters:
s - the string.
f - the name of the file.
java.lang.Exception

addFile

public static void addFile(java.lang.String file,
                           java.io.FileFilter ff,
                           boolean recursive,
                           boolean includeInvisible,
                           boolean includeDirs,
                           boolean includeFiles,
                           java.util.Collection to)
                    throws java.lang.Exception
Given a filename and a collection, performs a number of tests on the file, and if the file passes all of the tests, adds a java.io.File java.io.File object corresponding to the filename to the collection. If the file paasses and is a directory, optionally adds recursively.

Parameters:
file - the filename.
ff - if ff is not null, then ff must accept the file.
recursive - whether to add recursively if the file passes and is a directory.
includeInvisible - if includVisible is false, then the file must be visible.
includeDirs - if includeDirs is false, then the file must not be a directory.
includeFiles - if includeFiles is false, then the file must not be a regular file.
to - the collection.
java.lang.Exception

addFiles

public static void addFiles(java.util.Collection from,
                            java.io.FileFilter ff,
                            boolean recursive,
                            boolean includeInvisible,
                            boolean includeDirs,
                            boolean includeFiles,
                            java.util.Collection to)
                     throws java.lang.Exception
Calls addFile on each filename in the given collection.

Parameters:
from - the given collection.
ff - if ff is not null, then ff must accept the file.
recursive - whether to add recursively if the file passes and is a directory.
includeInvisible - if includVisible is false, then the file must be visible.
includeDirs - if the includeDirs is false, then the file must not be a directory.
includeFiles - if includeFiles is false, then the file must not be a regular file.
to - the collection to place the File objects.
java.lang.Exception

addFiles

public static void addFiles(java.lang.String[] from,
                            java.io.FileFilter ff,
                            boolean recursive,
                            boolean includeInvisible,
                            boolean includeDirs,
                            boolean includeFiles,
                            java.util.Collection to)
                     throws java.lang.Exception
Calls addFile on each filename in the given array.

Parameters:
from - the given array.
ff - if ff is not null, then ff must accept the file.
recursive - whether to add recursively if the file passes and is a directory.
includeInvisible - if includVisible is false, then the file must be visible.
includeDirs - if the includeDirs is false, then the file must not be a directory.
includeFiles - if includeFiles is false, then the file must not be a regular file.
to - the collection to place the File objects.
java.lang.Exception

process

public static void process(java.util.Collection c,
                           FileProcessor fp,
                           boolean display)
                    throws java.lang.Exception
Process each file in the given collection with the given FileProcessor.

Parameters:
c - the Collection.
fp - the FileProcessor.
display - Whether to display status messages to standard error.
java.lang.Exception