Java Utililty Methods BufferedReader Read Line

List of utility methods to do BufferedReader Read Line

Description

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

Method

ListreadLine(String filename, String encoding)
read Line
List<String> lines = new ArrayList<String>();
try {
    String content = "";
    BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(filename), encoding));
    while ((content = in.readLine()) != null) {
        content = content.trim();
        if (content.length() == 0)
            continue;
...
StringreadLine(String filepath)
Read line.
BufferedReader reader = new BufferedReader(new FileReader(filepath));
String line = reader.readLine();
reader.close();
return line;
ListreadLine(String filePathAndName, String encoding)
read the line content of text file, in array
PS. size of element = number of line
if (encoding == null)
    encoding = DEFAULT_ENCODING;
String string = "";
List<String> stringList = new ArrayList<>();
long i = 0;
BufferedReader reader = getBuffer(filePathAndName, encoding);
if (reader == null)
    return stringList;
...
StringreadLine(String fmt, Object... args)
read Line
java.io.Console console = System.console();
if (console != null) {
    return System.console().readLine(fmt, args);
} else {
    print(fmt, args);
    try {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        return buffer.readLine();
...
StringreadLine(String path)
read Line
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(path)))) {
    return reader.readLine();
StringreadLine(String prompt)
read Line
InputStreamReader inputStreamReader = new InputStreamReader(System.in);
BufferedReader stdin = new BufferedReader(inputStreamReader);
System.out.print(prompt + "> ");
System.out.flush();
return stdin.readLine();
StringreadLine(String prompt, boolean force)
read Line
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = null;
try {
    System.out.print(prompt + ":");
    System.out.flush();
    s = br.readLine();
    while (force && ((s == null) || (s.trim().length() == 0))) {
        System.out.print(prompt + ":");
...
StringreadLine(String s)
read Line
System.out.print(s);
String returnval = null;
try {
    returnval = bufRead.readLine();
} catch (IOException e) {
    e.printStackTrace();
return returnval;
...
StringreadLine(String s)
read Line
System.out.print(s);
String returnval = null;
try {
    BufferedReader bufRead = new BufferedReader(new InputStreamReader(System.in));
    returnval = bufRead.readLine();
} catch (IOException e) {
    throw new RuntimeException(e);
return returnval;
StringreadLine(String value, BufferedReader procout)
read Line
String line = "";
String found = "";
while ((line = procout.readLine()) != null) {
    if (found.length() == 0 && line.contains(value))
        found = line;
procout.close();
return found;
...