common/src/main/java/org/jboss/pnc/common/util/IoUtils.java
public static String readFileOrResource(String systemPropertyName, String defaultFileName,
            ClassLoader classLoader) throws IOException {

        String templateFileName = System.getProperty(systemPropertyName);

        if (templateFileName == null) {
            templateFileName = defaultFileName;
        }

        File file = new File(templateFileName); // try full path

        String configString;
        if (file.exists()) {
            try {
                byte[] encoded;
                encoded = Files.readAllBytes(Paths.get(file.getPath()));
                configString = new String(encoded, Charset.defaultCharset());
            } catch (IOException e) {
                throw new IOException("Cannot load " + templateFileName + ".", e);
            }
        } else {
            try {
                configString = IoUtils.readResource(templateFileName, classLoader);
            } catch (IOException e) {
                throw new IOException("Cannot load " + templateFileName + ".", e);
            }
        }

        if (configString == null) {
            throw new IOException("Cannot load " + templateFileName + ".");
        }

        return configString;
    }
public static String readFileOrResource(String systemPropertyName, String defaultFileName,
            ClassLoader classLoader) throws IOException {

        String templateFileName = System.getProperty(systemPropertyName);

        if (templateFileName == null) {
            templateFileName = defaultFileName;
        }

        File file = new File(templateFileName); // try full path

        String configString;
        if (file.exists()) {
            try {
                byte[] encoded;
                encoded = Files.readAllBytes(Paths.get(file.getPath()));
                configString = new String(encoded, Charset.defaultCharset());
            } catch (IOException e) {
                throw new IOException("Cannot load " + templateFileName + ".", e);
            }
        } else {
            try {
                configString = IoUtils.readResource(templateFileName, classLoader);
            } catch (IOException e) {
                throw new IOException("Cannot load " + templateFileName + ".", e);
            }
        }

        if (configString == null) {
            throw new IOException("Cannot load " + templateFileName + ".");
        }

        return configString;
    }
public static String readFileOrResource ( String systemPropertyName , String defaultFileName , ClassLoader classLoader ) throws IOException { String templateFileName = System . getProperty ( systemPropertyName ) ; if ( templateFileName == null ) { templateFileName = defaultFileName ; } File file = new File ( templateFileName ) ; // try full path String configString ; if ( file . exists ( ) ) { try { byte [ ] encoded ; encoded = Files . readAllBytes ( Paths . get ( file . getPath ( ) ) ) ; configString = new String ( encoded , Charset . defaultCharset ( ) ) ; } catch ( IOException e ) { throw new IOException ( "Cannot load " + templateFileName + "." , e ) ; } } else { try { configString = IoUtils . readResource ( templateFileName , classLoader ) ; } catch ( IOException e ) { throw new IOException ( "Cannot load " + templateFileName + "." , e ) ; } } if ( configString == null ) { throw new IOException ( "Cannot load " + templateFileName + "." ) ; } return configString ; }
<p>readFileOrResource.</p>

@param systemPropertyName Name of system property to override default file name
@param defaultFileName Filename to use if system property doesn't exist.
@param classLoader Classloader to use
@return The configuration string
@throws IOException Thrown if data couldn't be loaded
<p > readFileOrResource . < / p >