Java BufferedReader Read load(File file)

Here you can find the source of load(File file)

Description

load

License

Open Source License

Declaration

public static String load(File file) 

Method Source Code


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

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;

public class Main {
    public static String load(File file) {
        try {/*from w  w w . jav  a2s .c o m*/
            BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
            String s = "";
            while (true) {
                String s1 = reader.readLine();
                if (s1 == null)
                    break;
                s += s1;
            }
            reader.close();
            return s;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

Related

  1. load(File pFile)
  2. load(final Multimap map, final Reader source)
  3. load(final String path, final String file)
  4. load(String filename)