src2xml
Class FileUtils

java.lang.Object
  extended by src2xml.FileUtils

public class FileUtils
extends java.lang.Object

This class collects some File facilities


Nested Class Summary
static class FileUtils.RegexFilenameFilter
          A class that implements a regexp file filter
 
Constructor Summary
FileUtils()
           
 
Method Summary
static java.io.File EnsureFile(java.lang.String fname)
          Return a file with the given filename creating the necessary directories if not present
static java.lang.String ExtractExt(java.lang.String fname)
          Extract file extension
static java.util.ArrayList<java.io.File> FileList(java.io.File f, java.io.FilenameFilter filt, boolean recurse)
          Recursively walk a directory tree and return a List of all Files found matching a filter (no directories)
static java.lang.String JoinPaths(java.lang.String base, java.lang.String path)
          Join two paths
static java.lang.String RelativizePath(java.lang.String base, java.lang.String path)
          Relativize path
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

ExtractExt

public static java.lang.String ExtractExt(java.lang.String fname)
Extract file extension

Parameters:
fname - The input file path
Returns:
The extension
See Also:
String

RelativizePath

public static java.lang.String RelativizePath(java.lang.String base,
                                              java.lang.String path)
Relativize path

Parameters:
base - The input base path
path - The path to relativize
Returns:
The relativized path
See Also:
String

JoinPaths

public static java.lang.String JoinPaths(java.lang.String base,
                                         java.lang.String path)
Join two paths

Parameters:
base - The input base path
path - The tail path
Returns:
The joined path
See Also:
String

EnsureFile

public static java.io.File EnsureFile(java.lang.String fname)
                               throws java.io.IOException
Return a file with the given filename creating the necessary directories if not present

Parameters:
filename - The file to create
Returns:
The created File instance
Throws:
java.io.IOException

FileList

public static java.util.ArrayList<java.io.File> FileList(java.io.File f,
                                                         java.io.FilenameFilter filt,
                                                         boolean recurse)
Recursively walk a directory tree and return a List of all Files found matching a filter (no directories)

Parameters:
aStartingDir - a valid directory, which can be read
Returns:
The created File List