Java Utililty Methods BufferedReader Create

List of utility methods to do BufferedReader Create

Description

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

Method

BufferedReadergetReader(String filename)
get Reader
return getReader(new File(filename));
ReadergetReader(String filename)
getReader
if (filename == "") {
    return null;
if (filename.equals("-")) {
    return new BufferedReader(new InputStreamReader(System.in));
File inputFile = new File(filename);
if (!inputFile.exists()) {
...
BufferedReadergetReader(String filename)
get Reader
return getReader(filename, "UTF-8");
BufferedReadergetReader(String filePath, String charset)
get Reader
return new BufferedReader(new InputStreamReader(new FileInputStream(filePath), charset));
BufferedReadergetReader(String path)
get Reader
if (path.endsWith(".gz")) {
    return new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(path))));
return new BufferedReader(new FileReader(path));
BufferedReadergetReader(String Path)
get Reader
File file = new File(Path);
file.createNewFile();
return new BufferedReader(new FileReader(file));
BufferedReadergetReader(String path, String charEncoding)
get Reader
return getReader(new File(path), charEncoding);
BufferedReadergetReader(String path, String charEncoding)
get Reader
InputStream is = getInputStream(path);
return new BufferedReader(new InputStreamReader(is, charEncoding));
StringgetReaderAsString(Reader reader)
get Reader As String
StringWriter sw = new StringWriter();
BufferedReader in = new BufferedReader(reader);
char[] buf = new char[8192];
int n;
while ((n = in.read(buf)) > 0) {
    sw.write(buf, 0, n);
return sw.toString();
...
StringgetReaderText(BufferedReader reader)
get Reader Text
StringBuilder answer = new StringBuilder();
char[] charBuffer = new char[8192];
int nbCharRead ;
try {
    while ((nbCharRead = reader.read(charBuffer)) != -1) {
        answer.append(charBuffer, 0, nbCharRead);
} finally {
...