Java Utililty Methods File Content Read

List of utility methods to do File Content Read

Description

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

Method

StringgetFileContent(String fileName)
get File Content
try {
    return getFileContent(new FileInputStream(fileName));
} catch (FileNotFoundException e1) {
    return "";
StringgetFileContent(String fileName)
get File Content
File file = new File(fileName);
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);
StringBuffer content = new StringBuffer();
while (dis.available() != 0) {
    content.append(dis.readLine());
fis.close();
bis.close();
dis.close();
return content.toString();
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 fileName)
get File Content
BufferedReader reader = null;
StringBuilder fileContent = new StringBuilder();
try {
    File f = new File(fileName);
    reader = new BufferedReader(new FileReader(f));
    String line = "";
    while ((line = reader.readLine()) != null) {
        fileContent.append(line);
...
StringgetFileContent(String filePath)
get File Content
BufferedReader reader = null;
String tempData = "";
String eol = "\n\r";
try {
    String line;
    reader = new BufferedReader(new FileReader(filePath));
    while ((line = reader.readLine()) != null) {
        if (!tempData.equals("")) {
...
StringgetFileContent(String filePath)
get File Content
File file = new File(filePath);
if (!file.exists() || !file.isFile()) {
    return null;
StringBuffer content = new StringBuffer();
try {
    char[] temp = new char[1024];
    FileInputStream fileInputStream = new FileInputStream(file);
...
StringgetFileContent(String filepath)
get File Content
File f = new File(filepath);
BufferedReader reader = new BufferedReader(new FileReader(f));
String line;
String fileContent = "";
while ((line = reader.readLine()) != null) {
    fileContent += line;
reader.close();
...
StringgetFileContent(String fName)
get File Content
File f = new File(fName);
String ret = "";
if (!f.exists()) {
    return ret;
try {
    BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f)));
    String l;
...
ListgetFileContent(String path)
get File Content
List<String> strList = new ArrayList<String>();
try {
    File file = new File(path);
    InputStreamReader read = new InputStreamReader(new FileInputStream(file), "UTF-8");
    BufferedReader reader = new BufferedReader(read);
    String line;
    while ((line = reader.readLine()) != null) {
        strList.add(line);
...
ListgetFileContent(String path)
Gets the content of a file and returns it as list of lines.
BufferedReader site = new BufferedReader(new InputStreamReader(new FileInputStream(path)));
List<String> content = new ArrayList<String>();
String line = site.readLine();
while (line != null) {
    content.add(line);
    line = site.readLine();
site.close();
...