private static InputStream getFileAsStream(String pName, boolean pGuessSuffix) {
        InputStream is = null;
        File propertiesFile;

        try {
            if (!pGuessSuffix) {
                // Get file 
                propertiesFile = new File(pName);

                if (propertiesFile.exists()) {
                    is = new FileInputStream(propertiesFile);

                    // If XML, wrap stream
                    if (pName.endsWith(XML_PROPERTIES)) {
                        is = new XMLPropertiesInputStream(is);
                    }
                }
            }
            else {
                // Try normal properties 
                propertiesFile = new File(pName + STD_PROPERTIES);

                if (propertiesFile.exists()) {
                    is = new FileInputStream(propertiesFile);
                }
                else {
                    // Try XML
                    propertiesFile = new File(pName + XML_PROPERTIES);

                    if (propertiesFile.exists()) {
                        // Wrap stream
                        is = new XMLPropertiesInputStream(new FileInputStream(propertiesFile));
                    }
                }
            }
        }
        catch (FileNotFoundException fnf) {
            // Should not happen, as we always test that the file .exists()
            // before creating InputStream
            // assert false;
        }

        return is;
    }
private static InputStream getFileAsStream ( String pName , boolean pGuessSuffix ) { InputStream is = null ; File propertiesFile ; try { if ( ! pGuessSuffix ) { propertiesFile = new File ( pName ) ; if ( propertiesFile . exists ( ) ) { is = new FileInputStream ( propertiesFile ) ; if ( pName . endsWith ( XML_PROPERTIES ) ) { is = new XMLPropertiesInputStream ( is ) ; } } } else { propertiesFile = new File ( pName + STD_PROPERTIES ) ; if ( propertiesFile . exists ( ) ) { is = new FileInputStream ( propertiesFile ) ; } else { propertiesFile = new File ( pName + XML_PROPERTIES ) ; if ( propertiesFile . exists ( ) ) { is = new XMLPropertiesInputStream ( new FileInputStream ( propertiesFile ) ) ; } } } } catch ( FileNotFoundException fnf ) { } return is ; }
Gets the named file as a stream from the current directory.
If the pGuessSuffix parameter is true, the method will try to append
typical properties file suffixes, such as ".properties" or ".xml".

@param pName name of the resource
@param pGuessSuffix guess suffix

@return an input stream reading from the resource