org.mmbase.util
Class DirectoryLister

java.lang.Object
  extended by org.mmbase.util.DirectoryLister

public class DirectoryLister
extends Object

Directories contains methods for retrieving all file entries starting from a given path. It also goes down the directory tree in search for file entries. A wildcard can be used in searching for file entries. It also contains sort methods to sort file entries. Used by a device buidlers (i.e. Cameras), and by SCAN

Version:
$Id: DirectoryLister.java 35335 2009-05-21 08:14:41Z michiel $
Author:
David V van Zeventer
Application:
SCAN or Devices

Constructor Summary
DirectoryLister()
           
 
Method Summary
 Vector createThreeItems(Vector<String> sorted, StringTagger tagger)
          This method creates a vector with 3 items: ITEM1=fileentry, ITEM2=moddate, ITEM3=previewfilename if exists else fileentry.
 Vector getDirectories(String args)
          Returns all filepaths that follow a certain pattern.
 Vector reverse(Vector v)
          Reverses the elementorder in a vector.
 Vector reverse(Vector v, int items)
          Reverses the elementorder in a vector, taking into consideration that the vector consists of sets of elements (items).
 Vector<String> sortDirectories(Vector directories, String comparefield)
          Sort a Vector containing file pathnames using a comparefield argument.
 Vector<String> sortDirectoriesOnModTime(Vector directories)
          Sorts a Vector containing file pathnames on modification time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryLister

public DirectoryLister()
Method Detail

getDirectories

public Vector getDirectories(String args)
Returns all filepaths that follow a certain pattern.

Parameters:
args - The requeststring to be used. This string consists of a directory, followed by an extension.
Returns:
a vector containing all filepaths requested.

sortDirectoriesOnModTime

public Vector<String> sortDirectoriesOnModTime(Vector directories)
Sorts a Vector containing file pathnames on modification time.

Returns:
a new sorted Vector containing filepathnames.

sortDirectories

public Vector<String> sortDirectories(Vector directories,
                                      String comparefield)
Sort a Vector containing file pathnames using a comparefield argument. First creates XFile objs from vector. It then adds these objs to a SortedVector obj (sorted on comparefield)..

Returns:
a Vector with 2 items : filepath & moddate

createThreeItems

public Vector createThreeItems(Vector<String> sorted,
                               StringTagger tagger)
This method creates a vector with 3 items: ITEM1=fileentry, ITEM2=moddate, ITEM3=previewfilename if exists else fileentry.


reverse

public Vector reverse(Vector v)
Reverses the elementorder in a vector.


reverse

public Vector reverse(Vector v,
                      int items)
Reverses the elementorder in a vector, taking into consideration that the vector consists of sets of elements (items).



MMBase 2.0-SNAPSHOT - null