Android File to String Read getStringArrayFromFile(File inputFile)

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

Description

get String Array From File

Declaration

public static String[] getStringArrayFromFile(File inputFile)
            throws IOException 

Method Source Code

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

import java.util.ArrayList;

public class Main {
    public static String[] getStringArrayFromFile(File inputFile)
            throws IOException {
        ArrayList list = new ArrayList();
        BufferedReader br = new BufferedReader(new FileReader(inputFile));
        while (true) {
            String line = br.readLine();
            if (line == null)
                break;
            list.add(line);/*from   ww  w  . ja  v a 2s . co m*/
        }
        br.close();

        return (String[]) list.toArray(new String[0]);
    }
}

Related

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