Android File Read readTemplate(String filePath)

Here you can find the source of readTemplate(String filePath)

Description

read Template

License

Open Source License

Declaration

public static String readTemplate(String filePath) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;

import java.io.File;
import java.io.FileReader;

import java.io.IOException;

public class Main {
    public static String readTemplate(String filePath) throws IOException {
        File f = new File(filePath);
        if (!f.canRead())
            throw new IOException();

        BufferedReader in = new BufferedReader(new FileReader(filePath));
        String template = "";
        String line;//from   w w w  .ja v  a  2s.  c o m
        while ((line = in.readLine()) != null) {
            template += line;
        }
        in.close();
        return template;
    }
}

Related

  1. readFileToString(String fileName)
  2. readFileToString(String pathToFile)
  3. readFromFile(String filename)
  4. readInstallationFile(File installation)
  5. readStringFromFile(File file)
  6. readTextFile(File file)
  7. loadFile(String str)
  8. getFileContent(File file)
  9. LoadFile(String fileName, Resources resources)