Android File Read readFileAsString(String filePath)

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

Description

read File As String

Declaration

public static String readFileAsString(String filePath)
            throws java.io.IOException 

Method Source Code

//package com.java2s;
import java.io.BufferedReader;

import java.io.FileReader;

public class Main {
    public static String readFileAsString(String filePath)
            throws java.io.IOException {
        BufferedReader reader = new BufferedReader(new FileReader(filePath));
        String line;/*from   ww w .  ja  v a  2s  .  co  m*/
        String results = "";
        while ((line = reader.readLine()) != null) {
            results += line;
        }
        reader.close();
        //System.out.println("Config File: " + results);
        return results;
    }
}

Related

  1. read(File path, int i)
  2. readFile(File file)
  3. readFile(String filepath)
  4. readFileToByte(File file)
  5. readFileToString(String fileName)
  6. readFileToString(String pathToFile)
  7. readFromFile(String filename)