private static InputStream getResourceAsStream ( ClassLoader pClassLoader , String pName , boolean pGuessSuffix ) { InputStream is ; if ( ! pGuessSuffix ) { is = pClassLoader . getResourceAsStream ( pName ) ; // If XML, wrap stream if ( is != null && pName . endsWith ( XML_PROPERTIES ) ) { is = new XMLPropertiesInputStream ( is ) ; } } else { // Try normal properties is = pClassLoader . getResourceAsStream ( pName + STD_PROPERTIES ) ; // Try XML if ( is == null ) { is = pClassLoader . getResourceAsStream ( pName + XML_PROPERTIES ) ; // Wrap stream if ( is != null ) { is = new XMLPropertiesInputStream ( is ) ; } } } // Return stream return is ; }
Gets the named resource as a stream from the given Class Classoader . If the pGuessSuffix parameter is true the method will try to append typical properties file suffixes such as . properties or . xml .