Here you can find the source of getResourceAsStream(String name)
Parameter | Description |
---|---|
name | Name of the resource. |
public static InputStream getResourceAsStream(String name)
//package com.java2s; //License from project: Open Source License import java.io.InputStream; public class Main { /**/*from w ww . ja va 2 s . c om*/ * Returns an input stream from a file, given its name. * * @param name * Name of the resource. * @return File pointing to the resource. */ public static InputStream getResourceAsStream(String name) { return getContextClassLoader().getResourceAsStream(name); } /** * Obtains the class loader of the current thread. * * @return The class loader of the current thread. */ private static ClassLoader getContextClassLoader() { return Thread.currentThread().getContextClassLoader(); } }