Java Text File Load loadText(String path)

Here you can find the source of loadText(String path)

Description

load Text

License

Open Source License

Declaration

public static String loadText(String path) 

Method Source Code


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

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class Main {
    public static String loadText(String path) {
        String result = "";
        try {//w w  w  .j  av  a2 s  .  co m
            BufferedReader reader = new BufferedReader(new FileReader(path));
            String buffer;
            while ((buffer = reader.readLine()) != null) {
                result += buffer + "\n";
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return result;
    }
}

Related

  1. loadText(File file)
  2. loadText(File file)
  3. loadText(File file, int bufsize)
  4. loadText(java.io.File f)
  5. loadText(String fname)
  6. loadText(String path)
  7. loadTextFile(File file)
  8. loadTextFile(File textFile)
  9. loadTextFile(final String filePath)