List of usage examples for java.io BufferedReader BufferedReader
public BufferedReader(Reader in)
From source file:Main.java
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new FileReader("filename.txt")); String line = null;//from www . ja v a2 s .c o m while ((line = br.readLine()) != null) { System.out.println(line); } br.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new FileReader("thefile.csv")); String line = null;//from w w w . j a v a2 s . c om while ((line = br.readLine()) != null) { String[] values = line.split(","); for (String str : values) { System.out.println(str); } } br.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String input = reader.readLine(); double number = Double.parseDouble(input); System.out.println(input + ":" + Math.sqrt(number)); reader.close();//from w w w. j a v a 2 s . c o m }
From source file:Main.java
public static void main(String[] argv) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("infilename"), "UTF8")); String str = in.readLine();/*w w w . j a v a2s. co m*/ System.out.println(str); }
From source file:Main.java
public static void main(String[] argv) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("infilename"), "8859_1")); String str = in.readLine();/* w w w.j a v a 2s .c o m*/ System.out.println(str); }
From source file:Main.java
public static void main(String[] args) throws Exception { String thisLine = null;/*from w ww . ja va 2s. c o m*/ BufferedReader br = new BufferedReader(new FileReader("c:/test.txt")); while ((thisLine = br.readLine()) != null) { System.out.println(thisLine); } }
From source file:Main.java
public static void main(String[] args) throws Exception { String srcFile = "test.txt"; BufferedReader br = new BufferedReader(new FileReader(srcFile)); String text = null;//from www .jav a 2 s.c o m while ((text = br.readLine()) != null) { System.out.println(text); } br.close(); }
From source file:MainClass.java
public static void main(String[] args) throws IOException { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter a line:"); System.out.println(stdin.readLine()); }
From source file:MainClass.java
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String s;// w w w . j av a 2 s.c om while ((s = in.readLine()) != null && s.length() != 0) System.out.println(s); // An empty line or Ctrl-Z terminates the program }
From source file:BRReadLines.java
public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str;/* ww w.j av a 2s. co m*/ System.out.println("Enter lines of text."); System.out.println("Enter 'stop' to quit."); do { str = br.readLine(); System.out.println(str); } while (!str.equals("stop")); }