Java FileReader Create readTextFile(String text_file_name)

Here you can find the source of readTextFile(String text_file_name)

Description

read Text File

License

Open Source License

Declaration

public static String readTextFile(String text_file_name)
            throws Exception 

Method Source Code

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

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

public class Main {
    public static String readTextFile(String text_file_name)
            throws Exception {
        BufferedReader br = new BufferedReader(new FileReader(new File(
                text_file_name)));//from w  w  w.ja  v a2 s  . com
        StringBuffer buffer = new StringBuffer();

        String line = "";
        while ((line = br.readLine()) != null)
            buffer.append(line + "\n");
        br.close();

        return buffer.toString();
    }
}

Related

  1. readTextFile(String filePath)
  2. readTextFile(String fullPathFilename)
  3. readTextFile(String path)
  4. readTextFile(String path)
  5. readTextFile(String text_file_name)
  6. readTextFileAsList(File file)
  7. readTextFileContents(File fFile)
  8. readTextFileFully(File file)
  9. readTextFileLines(String fullPathFilename)