Java examples for File Path IO:BufferedReader
Read using BufferedReader till the end of text file
import java.io.BufferedReader; import java.io.FileReader; import java.io.Reader; public class FileReadereTest { public static void main(String[] args) throws Exception { Reader reader = null;//from ww w .ja v a 2 s . c om BufferedReader buffer = null; try { reader = new FileReader("C:/input.txt"); buffer = new BufferedReader(reader); char[] ch = new char[255]; while (true) { int result = buffer.read(ch); if (result == -1) { break; } System.out.println(new String(ch, 0, result)); } } finally { if (reader != null) { reader.close(); } } } }