public static String resourceFileToString(final String location, final String fileName) {
        if (location == null || fileName == null) return null;

        final InputStream in = ResourceUtilities.class.getResourceAsStream(location + fileName);
        if (in == null) return null;

        final BufferedReader br = new BufferedReader(new InputStreamReader(in));
        String line;
        final StringBuilder output = new StringBuilder("");
        try {
            while ((line = br.readLine()) != null) {
                output.append(line + "\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                LOG.error("Failed to close the InputStream", e);
            }
            try {
                br.close();
            } catch (IOException e) {
                LOG.error("Failed to close the BufferedReader", e);
            }
        }
        return output.toString();
    }
public static String resourceFileToString ( final String location , final String fileName ) { if ( location == null || fileName == null ) return null ; final InputStream in = ResourceUtilities . class . getResourceAsStream ( location + fileName ) ; if ( in == null ) return null ; final BufferedReader br = new BufferedReader ( new InputStreamReader ( in ) ) ; String line ; final StringBuilder output = new StringBuilder ( "" ) ; try { while ( ( line = br . readLine ( ) ) != null ) { output . append ( line + "\n" ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { try { in . close ( ) ; } catch ( IOException e ) { LOG . error ( "Failed to close the InputStream" , e ) ; } try { br . close ( ) ; } catch ( IOException e ) { LOG . error ( "Failed to close the BufferedReader" , e ) ; } } return output . toString ( ) ; }
Reads a resource file and converts it into a String

@param location The location of the resource file.
@param fileName The name of the file.
@return The string that represents the contents of the file or null if an error occurred.