@Override public Reader getResourceReader(String name, String encoding) throws ResourceNotFoundException { InputStreamReader result = null; if (StringUtils.isEmpty(name)) { throw new ResourceNotFoundException("No template name provided"); } String path = base + name; try { result = new InputStreamReader(ClassUtils.getResourceAsStream(getClass(), path), encoding); } catch (Exception fnfe) { throw new ResourceNotFoundException("problem with template: " + path, fnfe); } if (result == null) { throw new ResourceNotFoundException("ClasspathResourceLoader Error: cannot find resource " + path); } return result; }
@Override public InputStream getResourceStream(String name) throws ResourceNotFoundException { InputStream result = null; if (StringUtils.isEmpty(name)) { throw new ResourceNotFoundException("No template name provided"); } String path = base + name; try { result = ClassUtils.getResourceAsStream(getClass(), path); } catch (Exception fnfe) { throw (ResourceNotFoundException) ExceptionUtils.createWithCause( ResourceNotFoundException.class, "problem with template: " + path, fnfe); } if (result == null) { throw new ResourceNotFoundException("ClasspathResourceLoader Error: cannot find resource " + path); } return result; }
result = ClassUtils.getResourceAsStream( getClass(), name );
result = ClassUtils.getResourceAsStream( getClass(), name );
try rawStream = ClassUtils.getResourceAsStream( getClass(), name ); if (rawStream != null)
try in = ClassUtils.getResourceAsStream( getClass(), filePath ); if(null ==in){ return null;