Retrieves resource as input stream from a directory or jar in the filesystem.

@param fileName
@return
325936
public URL findResource(String fileName) {
		Object location = this.mixedResourceLocations.get(fileName);
		if (location == null) {
			return super.findResource(fileName);
		}
		String url;
		if (location instanceof File) {
			url = "file:/" + FileSupport.convertToUnixStylePath(((File) location).getAbsolutePath());
		} else {
			url = "jar:file:" + FileSupport.convertToUnixStylePath((String) location) + "!/" + fileName;
		}
		try {
			return new URL(url);
		} catch (MalformedURLException e) {
			throw new ResourceException(e);
		}
	}
155445
public InputStream getConfResourceAsInputStream(String name) {
		try {
			URL url= getResource(name);

			if (url == null) {
				LOG.info(name + " not found");
				return null;
			} else {
				LOG.info("found resource " + name + " at " + url);
			}

			return url.openStream();
		} catch (Exception e) {
			return null;
		}
	}
386757
public InputStreamReader getFileStream(String filename)
			throws NoSuchPathException{
		try {
			return new InputStreamReader(new FileInputStream(filename));
		} catch (FileNotFoundException e) {
			throw new NoSuchPathException(e);
		}
	}
1285093
public static InputStream loadFile(String fileName) {
        logger.entering(fileName);
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        InputStream iStream = loader.getResourceAsStream(fileName);
        if (iStream == null) {
            try {
                iStream = new FileInputStream(fileName);
            } catch (FileNotFoundException e) { // NOSONAR
                // Gobbling the checked exception here and doing nothing with it
                // because we are explicitly checking if the inputstream is null
                // and then throwing a runtime exception
            }
        }
        if (iStream == null) {
            throw new IllegalArgumentException("[" + fileName + "] is not a valid resource");
        }
        logger.exiting();
        return iStream;
    }
522834
public InputStream getResourceStream(String source) throws ResourceNotFoundException {
		return IoUtil.toStream(source, CharsetUtil.CHARSET_UTF_8);
	}
4513
private static InputStream getInputStreamFromFilename(String filename) {
        try {
            return new FileInputStream(filename);
        } catch (FileNotFoundException e) {
            log.debug("Error initializing RdfStreamReader, file '{}' not found", filename);
            // do not handle exception at construction time
            return null;
        }
    }
170000
public InputStream getTemporaryResourceAsStream(String resourceName) throws ResourceNotFoundException {
		InputStream is = null;
		if (useFileSystemTempDir) {
			File file = new File(resourceName);
			try {
				is = new FileInputStream(file);
			} catch (FileNotFoundException e) {
				throw new ResourceNotFoundException(resourceName);
			}
		} else {
			is = doGetResourceAsStream(resourceName);
		}

		if (is == null) {
			throw new ResourceNotFoundException(resourceName);
		}

		return is;
	}
860091
public static OutputStream getFileOutputStream(String filename) throws IOException {
    OutputStream out = new FileOutputStream(filename);
    if (filename.endsWith(".gz")) {
      out = new GZIPOutputStream(out);
    } else if (filename.endsWith(".bz2")) {
      //out = new CBZip2OutputStream(out);
      out = getBZip2PipedOutputStream(filename);
    }
    return out;
  }
31553
public static File getClasspathFile(String filename) {
    if(filename == null) {
      throw LOG.nullParameter("filename");
    }

    return getClasspathFile(filename, null);
  }
248024
public static InputStream openResourceStream(String resourceName) {
        InputStream stream = null;
        ClassLoader classLoader = Utils.class.getClassLoader();
        if (classLoader != null) {
            stream = classLoader.getResourceAsStream(resourceName);
        }

        if (stream == null) {
            stream = ClassLoader.getSystemResourceAsStream(resourceName);
        }
        return stream;
    }
1157916
public AtomMediaResource getMediaResource(final String fileName) throws Exception {
        final String filePath = getEntryMediaPath(fileName);
        final File resource = new File(filePath);
        return new AtomMediaResource(resource);
    }
869796
public final InputStream getResourceAsStream(final String name) {
		try {
			return this.getResource(name).openStream();
		} catch (final Exception ioe) {
			return null;
		}
	}
40308
public InputStream getResourceAsStream(String resourceName) {
		InputStream is = null;
		String realPath = getRealResourcePath(resourceName);
		if (isFileSystemPath(resourceName, realPath)) { // The resource has been
														// remapped to a file
														// system path
			try {
				is = new FileInputStream(realPath);
			} catch (FileNotFoundException e) {
				LOGGER.debug("The resource " + realPath + " has not been found");
			}
		}
		if (is == null) {
			is = super.getResourceAsStream(realPath);
		}
		return is;
	}
909054
public static InputStream getResourceAsStream(String resource) throws IOException {
    InputStream in = null;
    ClassLoader loader = ResourcesUtils.class.getClassLoader();
    if (loader != null) {
      in = loader.getResourceAsStream(resource);
    }
    if (in == null) {
      in = ClassLoader.getSystemResourceAsStream(resource);
    }
    if (in == null) {
      throw new IOException("Could not find resource " + resource);
    }
    return in;
  }
1333671
public static InputStream getResourceAsStream(String resourceName) throws URISyntaxException,
            ClassNotFoundException {
        return ResourceUtil.class.getClassLoader().getResourceAsStream(resourceName);
    }
1276562
public InputStream open(String fileName) {
        try {
            URL urlToFile = new URL(url, fileName);
            return urlToFile.openStream();
        } catch (MalformedURLException e) {
            throw new RuntimeException(String.format("error while forming new URL from URL %s and filename %s", url.getPath(), fileName), e);
        } catch (IOException e) {
            return null;
        }
    }
569302
@Override
	public URL getResourceUrl(String fileName) {
		if (fileName == null) {
			return null;
		}
		URL resource = getClass().getResource(fileName);
		if (resource == null) {
			resource = Thread.currentThread().getContextClassLoader().getResource(fileName);
			if (resource == null) {
				resource = ClassLoader.getSystemResource(fileName);
				if (resource == null) {
					File file = new File(fileName);
					if (file.exists()) {
						try {
							resource = file.toURI().toURL();
						} catch (MalformedURLException e) {
							throw new JKException(e);
						}
					}
				}
			}
		}
		return resource;
	}