Android Utililty Methods File Content Get

List of utility methods to do File Content Get

Description

The list of methods to do File Content Get are organized into topic(s).

Method

ListgetFileContent(String fileName)
Gets the content from a File as StringArray List.
List<String> result = new ArrayList<String>();
File aFile = new File(fileName);
if (!aFile.isFile()) {
    return result; 
BufferedReader reader = null;
try {
    reader = new BufferedReader(new FileReader(aFile));
...
StringgetFileContent(String filePath)
get File Content
Writer swriter = null;
Reader reader = null;
try {
    reader = new FileReader(filePath);
    swriter = new StringWriter();
    int len = 0;
    char[] buffer = new char[1024];
    while ((len = reader.read(buffer)) != -1) {
...
StringgetFileContent(String filePath, String charSet)
get File Content
return getFileContent(new File(filePath), charSet);
voidprintFileContent(String filePath)
print File Content
File file = new File(filePath);
BufferedReader reader = null;
try {
    reader = new BufferedReader(new java.io.FileReader(file));
    String line = null;
    while ((line = reader.readLine()) != null) {
        System.out.println(line);
} catch (FileNotFoundException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
} finally {
    try {
        if (reader != null) {
            reader.close();
    } catch (IOException e) {
        e.printStackTrace();