org.jboss.jdocbook.util
Class FileUtils

java.lang.Object
  extended by org.codehaus.plexus.util.FileUtils
      extended by org.jboss.jdocbook.util.FileUtils

public class FileUtils
extends org.codehaus.plexus.util.FileUtils

Various file and directory related utilities.

Author:
Steve Ebersole

Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.plexus.util.FileUtils
org.codehaus.plexus.util.FileUtils.FilterWrapper
 
Field Summary
static java.io.FileFilter ACCEPT_ALL
          A filter which simply accepts any file about which it is asked.
 
Fields inherited from class org.codehaus.plexus.util.FileUtils
FS, ONE_GB, ONE_KB, ONE_MB
 
Constructor Summary
FileUtils()
           
 
Method Summary
static javax.xml.transform.sax.SAXSource createSAXSource(java.io.File file, org.xml.sax.EntityResolver resolver, boolean xincludeAware)
          Create a SAXSource from a given file.
static java.lang.String determineRelativity(java.io.File file, java.io.File basedir)
          Determine the 'relativity' of a file in relation to the given basedir.
static long findLeastRecentTimestamp(java.io.File directory, java.io.FileFilter acceptor)
          (recursively) find the least recent timestamp in said directory.
static long findLeastRecentTimestamp(long current, java.io.File directory, java.io.FileFilter acceptor)
           
static long findMostRecentTimestamp(java.io.File directory, java.io.FileFilter acceptor)
          (recursively) find the most recent timestamp in said directory.
static java.lang.String resolveFullPathName(java.io.File path)
          Here for consistent handling of full path names.
 
Methods inherited from class org.codehaus.plexus.util.FileUtils
basename, basename, byteCountToDisplaySize, catPath, cleanDirectory, cleanDirectory, contentEquals, copyDirectory, copyDirectory, copyDirectoryStructure, copyDirectoryStructureIfModified, copyFile, copyFile, copyFileIfModified, copyFileToDirectory, copyFileToDirectory, copyFileToDirectoryIfModified, copyFileToDirectoryIfModified, copyURLToFile, createTempFile, deleteDirectory, deleteDirectory, dirname, extension, fileAppend, fileAppend, fileDelete, fileExists, filename, fileRead, fileRead, fileRead, fileRead, fileWrite, fileWrite, forceDelete, forceDelete, forceDeleteOnExit, forceMkdir, getDefaultExcludes, getDefaultExcludesAsList, getDirectoryNames, getDirectoryNames, getExtension, getFile, getFileAndDirectoryNames, getFileNames, getFileNames, getFiles, getFiles, getFilesFromExtension, getPath, getPath, loadFile, mkdir, normalize, removeExtension, removePath, removePath, rename, resolveFile, sizeOfDirectory, sizeOfDirectory, toFile, toURLs, waitFor, waitFor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCEPT_ALL

public static final java.io.FileFilter ACCEPT_ALL
A filter which simply accepts any file about which it is asked.

Constructor Detail

FileUtils

public FileUtils()
Method Detail

createSAXSource

public static javax.xml.transform.sax.SAXSource createSAXSource(java.io.File file,
                                                                org.xml.sax.EntityResolver resolver,
                                                                boolean xincludeAware)
Create a SAXSource from a given file.

NOTE: the result is buffered.

Parameters:
file - The file from which to generate a SAXSource
resolver - An entity resolver to apply to the file reader.
xincludeAware - Should we handle XIncludes?
Returns:
An appropriate SAXSource

determineRelativity

public static java.lang.String determineRelativity(java.io.File file,
                                                   java.io.File basedir)
Determine the 'relativity' of a file in relation to the given basedir. 'relativity', is the relative path from the basedir to the file's parent (directory).

For example, a file /home/steve/hibernate/tmp/Test.java would have a relativity of hibernate/tmp relative to /home/steve as the basedir.

Parameters:
file - The file for which to determine relativity.
basedir - The directory from which to base the relativity.
Returns:
The relativity.
Throws:
java.lang.RuntimeException - Indicates that the given file was not found to be relative to basedir.

findMostRecentTimestamp

public static long findMostRecentTimestamp(java.io.File directory,
                                           java.io.FileFilter acceptor)
(recursively) find the most recent timestamp in said directory.

Parameters:
directory - The directory to check.
acceptor - A filter telling which files to consider.
Returns:
The most recent timestamp found.

findLeastRecentTimestamp

public static long findLeastRecentTimestamp(java.io.File directory,
                                            java.io.FileFilter acceptor)
(recursively) find the least recent timestamp in said directory.

Parameters:
directory - The directory to check.
acceptor - A filter telling which files to consider.
Returns:
The least recent timestamp found.

findLeastRecentTimestamp

public static long findLeastRecentTimestamp(long current,
                                            java.io.File directory,
                                            java.io.FileFilter acceptor)

resolveFullPathName

public static java.lang.String resolveFullPathName(java.io.File path)
Here for consistent handling of full path names.

Parameters:
path - The path
Returns:
The full path name.


Copyright © 2007-2009 JBoss, a division of Red Hat, Inc. All Rights Reserved.