public static InputStream getFirstAvailableStream ( Collection < String > names ) { ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver ( IOUtils . class . getClassLoader ( ) ) ; for ( String name : names ) { try { InputStream stream = getInputStreamWithResolver ( resolver , name ) ; if ( stream != null ) { return stream ; } } catch ( MustacheIOException ex ) { // Go to the next test } } throw new MustacheIOException ( "Unable to locate one of: " + names ) ; }
Return an input stream from given names . First result returning a valid stream is returned . Names are searched into the classpath . Names can contains ant style pattern .