/** * Open the file found at the the specified path under the location of the given * class. * * @param clazz the class location * @param path the path in the class location * @return an input stream representating the requested file * @throws IllegalArgumentException if there was an error opening the stream */ public static InputStream openStream(final Class clazz, final String path) throws IllegalArgumentException { final String checkedPath = formatPathForOpenStream(path); final InputStream resourceAsStream = clazz.getResourceAsStream(checkedPath); return (null != resourceAsStream) ? resourceAsStream : processException(path); }