Here you can find the source of getInputStream(String filename)
Parameter | Description |
---|---|
filename | a parameter |
public static InputStream getInputStream(String filename)
//package com.java2s; //License from project: Open Source License import java.io.InputStream; public class Main { /**/*from ww w.jav a 2s .c o m*/ * Return the contents of a file as {@link InputStream}. * * @param filename * @return stream */ public static InputStream getInputStream(String filename) { // Get the calling class from the stacktrace String callerClass = Thread.currentThread().getStackTrace()[2].getClassName(); try { return Class.forName(callerClass).getResourceAsStream(filename); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } }