db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/util ClassHelper.java
Date Fri, 09 Jul 2004 15:37:32 GMT
tomdz       2004/07/09 08:37:32

  Modified:    src/java/org/apache/ojb/broker/util ClassHelper.java
  Log:
  Added convenience methods for loading resources via the classloader
  
  Revision  Changes    Path
  1.11      +26 -1     db-ojb/src/java/org/apache/ojb/broker/util/ClassHelper.java
  
  Index: ClassHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/ClassHelper.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ClassHelper.java	1 Jun 2004 19:15:23 -0000	1.10
  +++ ClassHelper.java	9 Jul 2004 15:37:32 -0000	1.11
  @@ -15,6 +15,9 @@
    * limitations under the License.
    */
   
  +import java.io.InputStream;
  +import java.io.Reader;
  +import java.io.InputStreamReader;
   import java.lang.reflect.InvocationTargetException;
   import java.lang.reflect.Method;
   import java.lang.reflect.Field;
  @@ -89,6 +92,28 @@
           return getClassLoader().getResource(name);
       }
       
  +    /**
  +     * Returns an input stream for the indicated resource using the currently set class
loader.
  +     * 
  +     * @param name The resource name
  +     * @return The stream
  +     */
  +    public static InputStream getResourceAsStream(String name)
  +    {
  +        return getClassLoader().getResourceAsStream(name);
  +    }
  +
  +    /**
  +     * Returns an reader for the indicated resource using the currently set class loader.
  +     * 
  +     * @param name The resource name
  +     * @return The reader
  +     */
  +    public static Reader getResourceAsReader(String name)
  +    {
  +        return new InputStreamReader(getResourceAsStream(name));
  +    }
  +
       /**
        * Retrieves the class object for the given qualified class name.
        * 
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message