Here you can find the source of getStreamForFile(String fileName)
public static InputStream getStreamForFile(String fileName) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class Main { /**/* w ww . j a v a 2 s . c o m*/ * Open an input stream from a file, which may exist as a physical file or * in a JAR file. The name must be valid for both options. * * @author Erik Vos */ public static InputStream getStreamForFile(String fileName) throws IOException { File file = new File(fileName); if (file.exists()) { return new FileInputStream(file); } else { return null; } } }