private static InputStream getResourceAsStream ( String path ) throws IOException { if ( StringUtils . isEmpty ( path ) ) { return null ; } // first try to load as file File file = new File ( path ) ; if ( file . exists ( ) && file . isFile ( ) ) { return new FileInputStream ( file ) ; } // if not a file fallback to classloader resource return CertificateLoader . class . getResourceAsStream ( path ) ; }
Tries to load the given resource as file or if no file exists as classpath resource .