Java Utililty Methods File to Reader

List of utility methods to do File to Reader

Description

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

Method

BufferedReadernewReader(File file)
new Reader
return new BufferedReader(new FileReader(file));
ReadernewReader(File file, String charset)
new Reader
return new InputStreamReader(new FileInputStream(file), charset);
BufferedReadernewReader(File file, String encoding)
new Reader
if (encoding == null || encoding.length() <= 0) {
    return new BufferedReader(new InputStreamReader(new FileInputStream(file)));
return new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding));
BufferedReadernewReader(File pathname)
new Reader
InputStream is = null;
try {
    is = new FileInputStream(pathname);
    return new BufferedReader(new InputStreamReader(is, "UTF-8"));
} catch (IOException e) {
    close(is);
return null;
...
BufferedReadernewReader(String value)
new Reader
return (new BufferedReader(new StringReader(value)));
ReaderopenReader(File file)
Opens a Reader on a file.
checkNull(file);
try {
    return new FileReader(file);
} catch (FileNotFoundException e) {
return null;
InputStreamReaderopenReader(final String file, String charset)
open Reader
return new InputStreamReader(open(file), charset);
BufferedReaderopenReader(String dir, String filename, String encoding)
open Reader
File file = new File(dir + filename);
return new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding), 4 * 1024);
BufferedReaderopenReader(String file)
Create a newBufferedReader
try {
    File f = new File(file);
    if (f.exists() == false) {
        return null;
    return new BufferedReader(new FileReader(file));
} catch (Exception e) {
    e.printStackTrace();
...
FileReaderopenReader(String filePath)
open Reader
return openReader(new File(filePath));