Create BufferedReader from InputStreamReader and read line by line : InputStreamReader « File Input Output « Java






Create BufferedReader from InputStreamReader and read line by line

 


import java.io.BufferedReader;
import java.io.InputStreamReader;

class ReadConsole {

  public static void main(String args[]) throws Exception {
    InputStreamReader isr = new InputStreamReader(System.in);

    BufferedReader br = new BufferedReader(isr);

    String s;
    while ((s = br.readLine()) != null) {
      System.out.println(s.length());
    }
    isr.close();
  }
}

   
  








Related examples in the same category

1.Create BufferedReader from InputStreamReader
2.Create BufferedReader from InputStreamReader and URL
3.Reading ISO Latin-1 Encoded Data
4.Deal with Keyboard Input with BufferedReader