Java Resource Load getResourceStream(String name)

Here you can find the source of getResourceStream(String name)

Description

Resources are those stored in the class path (e.g., src/main/resources).

License

Open Source License

Declaration

public static InputStream getResourceStream(String name) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.InputStream;

public class Main {
    /** Resources are those stored in the class path (e.g., src/main/resources). */
    public static InputStream getResourceStream(String name) {
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        return loader.getResourceAsStream(name);
    }/*from  w ww  . j  av  a  2s.  c  o  m*/
}

Related

  1. getResourceSize(ClassLoader classLoader, String path)
  2. getResourceStream(Class clazz, String resourceName)
  3. getResourceStream(final String resource)
  4. getResourceStream(final String resourcePath)
  5. getResourceStream(String className, ClassLoader classLoader)
  6. getResourceStream(String pathToResource)
  7. getResourceStream(String resource, Class root)
  8. getResourceStreamFromClasspath(Class clazz, String resourceName)
  9. getResourceStreamInPackage(Class clazz, String name)