Java Utililty Methods FileReader Create

List of utility methods to do FileReader Create

Description

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

Method

ReadergetFileReader(File file)
get File Reader
return new FileReader(file);
BufferedReadergetFileReader(File file)
get File Reader
return file.getName().endsWith(".gz")
        ? new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(file))))
        : new BufferedReader(new FileReader(file));
ReadergetFileReader(String fileName)
Obtains a reader for the given already existing file.
FileReader reader;
File file = new File(fileName);
if (file.exists() && file.isFile()) {
    reader = new FileReader(file);
} else {
    reader = null;
return reader;
...
ReadergetFileReader(String filename)
get File Reader
return getFileReader(new File(filename));
FileReadergetFileReader(String fileName)
Getting a file reader of fileName
return getFileReader(new File(fileName));
ReadergetFileReader(String filePath)
get File Reader
return new FileReader(filePath);
FileReadergetFileReader(String sFileName)
Return a FileReader for the current file name or null if the file doesn't exist
FileReader fr = null;
if (sFileName != null) {
    try {
        fr = new FileReader(sFileName);
    } catch (FileNotFoundException e) {
        fr = null;
return fr;
FileReadergetReader(final File file)
get Reader
try {
    return new FileReader(file);
} catch (final FileNotFoundException e) {
    throw new IllegalArgumentException("File not found: " + file, e);
StringreadTextFile(File aFile)
read Text File
return read(new BufferedReader(new FileReader(aFile)));
StringreadTextFile(File f)
read Text File
StringBuilder sb = new StringBuilder();
try {
    if (!f.exists()) {
        return "";
    FileReader reader = new FileReader(f);
    char[] chars = new char[4096];
    int len = 4096;
...