org.das2.util.filesystem
Class Glob

java.lang.Object
  extended by org.das2.util.filesystem.Glob

public class Glob
extends java.lang.Object

known bug: *.java matches ".java". The unix glob behavior is to require that a leading . must be explicitly matched.


Constructor Summary
Glob()
           
 
Method Summary
static javax.swing.filechooser.FileFilter getGlobFileFilter(java.lang.String glob)
           
static java.util.regex.Pattern getPattern(java.lang.String glob)
          converts a glob into a Pattern.
static java.lang.String getRegex(java.lang.String glob)
          converts a glob into a regex.
static FileObject[] unGlob(FileSystem fs, java.lang.String glob)
          unglob the glob into an array of the matching FileObjects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Glob

public Glob()
Method Detail

getPattern

public static java.util.regex.Pattern getPattern(java.lang.String glob)
converts a glob into a Pattern.

Parameters:
glob - a string like '*.dat'
Returns:
a Pattern for the glob, for example *.dat -> .*\.dat

getRegex

public static java.lang.String getRegex(java.lang.String glob)
converts a glob into a regex.


unGlob

public static FileObject[] unGlob(FileSystem fs,
                                  java.lang.String glob)
                           throws java.io.IOException
unglob the glob into an array of the matching FileObjects.

Parameters:
glob -
Returns:
an array of FileObjects that match the glob.
Throws:
java.io.IOException

getGlobFileFilter

public static javax.swing.filechooser.FileFilter getGlobFileFilter(java.lang.String glob)