xdoclet.util
Class FileUtils

java.lang.Object
  |
  +--xdoclet.util.FileUtils

public class FileUtils
extends Object

Utility methods for dealing with directories and zip files.

Version:
$Revision: 1.7 $
Author:
Aslak Hellesøy

Constructor Summary
FileUtils()
           
 
Method Summary
static InputStream getResourceAsStream(File file, String resourcePath)
          Returns an InputStream for a resource relative to a file.
static File getRoot(Class clazz)
          Returns the root directory of the package hierarchy where this class is located.
static boolean isJar(File file)
          Returns true if the file can be read as a zip file.
 
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

getResourceAsStream

public static InputStream getResourceAsStream(File file,
                                              String resourcePath)
Returns an InputStream for a resource relative to a file. The file can be a directory or a zip/jar file. The InputStream is the resource located at a relative path from the file or zip/jar file

Parameters:
file - directory or zip/jar
resourcePath - the path of the resource, relative to file.
Returns:
an InputStream for the relative path to the dir or jar, or null if not found.

isJar

public static boolean isJar(File file)
Returns true if the file can be read as a zip file.

Parameters:
file - the file to test.
Returns:
true if zip. false otherwise.

getRoot

public static File getRoot(Class clazz)
Returns the root directory of the package hierarchy where this class is located. This will either be a directory or a jar file.

Returns:
the root directory or jar file where the class is located.


Copyright © 2000-2003 XDoclet Team. All Rights Reserved.