Java Resource Load getResourceAsStream(String resource, ClassLoader classLoader)

Here you can find the source of getResourceAsStream(String resource, ClassLoader classLoader)

Description

get Resource As Stream

License

Apache License

Declaration

private static InputStream getResourceAsStream(String resource, ClassLoader classLoader) 

Method Source Code


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

import java.io.InputStream;

public class Main {
    private static InputStream getResourceAsStream(String resource, ClassLoader classLoader) {
        InputStream returnValue = classLoader.getResourceAsStream(resource);
        if (null == returnValue) {
            returnValue = classLoader.getResourceAsStream("/" + resource);
        }/* w ww . j  a  v  a  2s. c  o  m*/
        if (null != returnValue) {
            return returnValue;
        }
        return null;
    }
}

Related

  1. getResourceAsStream(String path, ClassLoader cl)
  2. getResourceAsStream(String path, ClassLoader loader)
  3. getResourceAsStream(String relativeName, Class clazz)
  4. getResourceAsStream(String res)
  5. getResourceAsStream(String resName, Object obj)
  6. getResourceAsStream(String resource, ClassLoader classLoader)
  7. getResourceAsStream(String resourcePath)
  8. getResourceAsStreamInClassPath(@SuppressWarnings("rawtypes") Class clazz, String filepath)
  9. getResourceAsStrem(String name)