Java BufferedReader Read load(File pFile)

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

Description

load

License

Open Source License

Declaration

public static String load(File pFile) 

Method Source Code


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

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

import java.util.Vector;

public class Main {
    public static Vector Exception = new Vector();

    public static String load(File pFile) {
        if (pFile == null || !pFile.canRead())
            return null;
        FileReader in = null;/*from   w  w w .  jav a 2  s .c om*/
        BufferedReader buf = null;
        StringBuffer lString = new StringBuffer();
        try {
            in = new FileReader(pFile);
            buf = new BufferedReader(in);
            String line;
            while ((line = buf.readLine()) != null) {
                lString.append(line);
            }
        } catch (Exception e) {
            return null;
        } finally {
            try {
                if (buf != null)
                    buf.close();
                if (in != null)
                    in.close();
            } catch (Exception e) {
                return null;
            }
        }
        return lString.toString();
    }
}

Related

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