Java Utililty Methods FileReader Read All

List of utility methods to do FileReader Read All

Description

The list of methods to do FileReader Read All are organized into topic(s).

Method

StringreadAll(File file)
read the contents of a file into a String
FileReader fileReader = new FileReader(file);
try {
    StringBuffer sb = new StringBuffer();
    char[] b = new char[8192];
    int n;
    while ((n = fileReader.read(b)) > 0) {
        sb.append(b, 0, n);
    return sb.toString();
} finally {
    fileReader.close();
StringreadAll(String path)
Overloaded.
return readAll(new File(path));
voidreadAllKeys(String propertyFileName, String xmlFileName)
read all the keys from the given property files
System.out.println("Start of readAllKeys");
Properties prop = new Properties();
FileReader reader = new FileReader(propertyFileName);
prop.load(reader);
Set<Object> keys = prop.keySet();
for (Object obj : keys) {
    System.out.println(
            propertyFileName + ":: Key=" + obj.toString() + "::value=" + prop.getProperty(obj.toString()));
...
String[]readAllLines(String filePath)
Reads the contents of the specified file
List<String> lines = fileToStringList(filePath);
return lines.toArray(new String[lines.size()]);