Android File to String Read getStringFromFile(File inputFile)

Here you can find the source of getStringFromFile(File inputFile)

Description

get String From File

Declaration

public static String getStringFromFile(File inputFile)
            throws IOException 

Method Source Code

import java.io.*;
import java.net.*;
import java.util.ArrayList;
import java.util.Arrays;
import org.apache.commons.lang.Validate;

public class Main{
    public static String getStringFromFile(String fileName)
            throws IOException {
        Validate.notEmpty(fileName);/*from   ww w. j  a  v a2  s.co m*/
        return getStringFromFile(new File(fileName));
    }
    public static String getStringFromFile(File inputFile)
            throws IOException {
        Validate.notNull(inputFile);
        Validate.isTrue(inputFile.exists());

        return IO.toString(new FileInputStream(inputFile));
    }
}

Related

  1. getStringArrayFromFile(File inputFile)
  2. fromFile(File f)
  3. readFile(String path)
  4. readFileOfList(String path)