org.yestech.lib.io
Class FileLocator

java.lang.Object
  extended by org.yestech.lib.io.FileLocator

public final class FileLocator
extends java.lang.Object

This class will find any file located in the users classpath.

Author:
Arthur Copeland

Method Summary
static FileLocator getFile()
          Creates a new FileLocator
 java.net.URL locateFile(java.lang.String file)
          Locates a file in the classes classpath and returns the URL associated with the file.
 java.net.URL locateFile(java.lang.String file, java.lang.String extension)
          Locates a file in the classes classpath and returns the URL associated with the file.
 java.io.InputStream locateFileAsStream(java.lang.String file)
          Locates a file in the classes classpath and returns the InputStream associated with the file.
 java.io.InputStream locateFileAsStream(java.lang.String file, java.lang.String extension)
          Locates a file in the classes classpath and returns the InputStream associated with the file.
 java.net.URL locatePropertiesFile(java.lang.String file)
          Locates a properties file in the classes classpath and returns the URL associated with the file.
 java.io.InputStream locatePropertiesFileAsStream(java.lang.String file)
          Locates a properties file in the classes classpath and returns the InputStream associated with the file.
 java.net.URL locateXMLFile(java.lang.String file)
          Locates an xml file in the classes classpath and returns the URL associated with the file.
 java.io.InputStream locateXMLFileAsStream(java.lang.String file)
          Locates an xml file in the classes classpath and returns the InputStream associated with the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

locatePropertiesFile

public java.net.URL locatePropertiesFile(java.lang.String file)
Locates a properties file in the classes classpath and returns the URL associated with the file.

Parameters:
file - the file to locate
Returns:
the URL associated with the file or NULL if file not found

locateXMLFile

public java.net.URL locateXMLFile(java.lang.String file)
Locates an xml file in the classes classpath and returns the URL associated with the file.

Parameters:
file - the file to locate
Returns:
the URL associated with the file or NULL if file not found

locateFile

public java.net.URL locateFile(java.lang.String file,
                               java.lang.String extension)
Locates a file in the classes classpath and returns the URL associated with the file. If the file doesn't have an extension then the extension parameter MUST be NULL.

Parameters:
file - the file to locate
extension - the extension of the file to locate
Returns:
the URL associated with the file or NULL if file not found

locateFile

public java.net.URL locateFile(java.lang.String file)
Locates a file in the classes classpath and returns the URL associated with the file.

Parameters:
file - the file to locate
Returns:
the URL associated with the file or NULL if file not found

locatePropertiesFileAsStream

public java.io.InputStream locatePropertiesFileAsStream(java.lang.String file)
Locates a properties file in the classes classpath and returns the InputStream associated with the file.

Parameters:
file - the file to locate
Returns:
the InputStream associated with the file or NULL if file not found

locateXMLFileAsStream

public java.io.InputStream locateXMLFileAsStream(java.lang.String file)
Locates an xml file in the classes classpath and returns the InputStream associated with the file.

Parameters:
file - the file to locate
Returns:
the InputStream associated with the file or NULL if file not found

locateFileAsStream

public java.io.InputStream locateFileAsStream(java.lang.String file,
                                              java.lang.String extension)
Locates a file in the classes classpath and returns the InputStream associated with the file.

Parameters:
file - the file to locate
extension - the extension of the file to locate
Returns:
the InputStream associated with the file or NULL if file not found

locateFileAsStream

public java.io.InputStream locateFileAsStream(java.lang.String file)
Locates a file in the classes classpath and returns the InputStream associated with the file.

Parameters:
file - the file to locate
Returns:
the InputStream associated with the file or NULL if file not found

getFile

public static FileLocator getFile()
Creates a new FileLocator

Returns:
new FileLocator


Copyright © 2009 YES Technology Association. All Rights Reserved.