org.osesb.utilities.fileio
Class ClassLoaderFileReader
java.lang.Object
org.osesb.utilities.fileio.ClassLoaderFileReader
public class ClassLoaderFileReader
- extends java.lang.Object
This Class contains one method that reads a file in a
class loader sensitive manner.
- Since:
- Version .9
|
Method Summary |
java.io.InputStream |
getResourceAsStream(java.lang.String resourcePath)
Opens an InputStream on a resource in a class loader sensitive manner. |
java.lang.String |
readFile(java.lang.String resourcePath)
Reads files in a class loader sensitive manner. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
thisClassName
protected java.lang.String thisClassName
ClassLoaderFileReader
public ClassLoaderFileReader()
- Creates a new instance of ClassLoaderFileReader.
readFile
public java.lang.String readFile(java.lang.String resourcePath)
throws java.io.IOException,
java.lang.Exception
- Reads files in a class loader sensitive manner.
- Parameters:
resourcePath - The path of the file to read, relative
to the class loader's classpath, so resourcePath has to be
in the classpath.
- Returns:
- the contents of the file as a String.
- Throws:
java.io.IOException - if there is an exception reading the file.
java.lang.Exception
getResourceAsStream
public java.io.InputStream getResourceAsStream(java.lang.String resourcePath)
throws java.io.IOException,
java.lang.Exception
- Opens an InputStream on a resource in a class loader sensitive manner.
- Parameters:
resourcePath - The path to the resource get as a InputStream.
- Returns:
- an InputStream on the resource.
- Throws:
java.io.IOException - if there is an exception reading the resource.
java.lang.Exception