Java Resource Load getResource(final String aResName)

Here you can find the source of getResource(final String aResName)

Description

Loads a resource from the classpath.

License

BSD License

Parameter

Parameter Description
aResName The resource to fetch.

Return

A handle for the resource or null if the resource is not found.

Declaration

public static InputStream getResource(final String aResName) 

Method Source Code

//package com.java2s;
//License from project: BSD License 

import java.io.InputStream;

public class Main {
    /**//from  w  ww  .ja v a2 s.  c o m
     * Loads a resource from the classpath.
     * 
     * @param aResName
     *            The resource to fetch.
     * @return A handle for the resource or null if the resource is not found.
     */
    public static InputStream getResource(final String aResName) {
        return Thread.currentThread().getContextClassLoader().getResourceAsStream(aResName);
    }
}

Related

  1. getResource(Class c, String path)
  2. getResource(Class clazz, String fileName)
  3. getResource(Class clazz, String name, String charset)
  4. getResource(Class c, String name)
  5. getResource(ClassLoader classLoader, final String path)
  6. getResource(final String resource)
  7. getResource(String fileName)
  8. getResource(String fileName, int type)
  9. getResource(String name)