Android Utililty Methods File to String Read

List of utility methods to do File to String Read

Description

The list of methods to do File to String Read are organized into topic(s).

Method

String[]getStringArrayFromFile(File inputFile)
get String Array From File
ArrayList list = new ArrayList();
BufferedReader br = new BufferedReader(new FileReader(inputFile));
while (true) {
    String line = br.readLine();
    if (line == null)
        break;
    list.add(line);
br.close();
return (String[]) list.toArray(new String[0]);
StringgetStringFromFile(File inputFile)
get String From File
Validate.notNull(inputFile);
Validate.isTrue(inputFile.exists());
return IO.toString(new FileInputStream(inputFile));
StringfromFile(File f)
from File
InputStream is = new FileInputStream(f);
byte[] bs = new byte[is.available()];
is.read(bs);
is.close();
return new String(bs);
StringreadFile(String path)
read File
StringBuffer str = new StringBuffer("");
try {
    InputStreamReader ir = new InputStreamReader(
            new FileInputStream(path), "UTF8");
    BufferedReader br = new BufferedReader(ir);
    String data = br.readLine();
    while (data != null) {
        str.append(data);
...
ListreadFileOfList(String path)
read File Of List
List<String> list = new ArrayList<String>();
InputStreamReader ir = null;
BufferedReader br = null;
try {
    ir = new InputStreamReader(new FileInputStream(path), "UTF8");
    br = new BufferedReader(ir);
    String data = br.readLine();
    while (data != null) {
...