src/main/java/tinyrtpl/Rtpl.java
public static String readFile(String fileName) {
        if (fileName == null) return "";
        BufferedReader br = null;
        StringBuilder sb = new StringBuilder("");
        try {
            String curLine;
            br = new BufferedReader(new FileReader(fileName));
            while ((curLine = br.readLine()) != null) {
                sb.append(curLine + "\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (br != null) br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
        return sb.toString();
    }
/**
     * Read a template file to a string.
     * @param fileName: name of the template file
     * @return a string
     */
Read a template file to a string.
@param fileName: name of the template file
@return a string
Read a template file to a string . @param fileName : name of the template file @return a string
public static String readFile(String fileName) {
        if (fileName == null) return "";
        BufferedReader br = null;
        StringBuilder sb = new StringBuilder("");
        try {
            String curLine;
            br = new BufferedReader(new FileReader(fileName));
            while ((curLine = br.readLine()) != null) {
                sb.append(curLine + "\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (br != null) br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
        return sb.toString();
    }
public static String readFile ( String fileName ) { if ( fileName == null ) return "" ; BufferedReader br = null ; StringBuilder sb = new StringBuilder ( "" ) ; try { String curLine ; br = new BufferedReader ( new FileReader ( fileName ) ) ; while ( ( curLine = br . readLine ( ) ) != null ) { sb . append ( curLine + "\n" ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { try { if ( br != null ) br . close ( ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; } } return sb . toString ( ) ; }
Read a template file to a string.
Read a template file to a string .