import java.io.BufferedReader; import java.io.FileReader; public class IOExamples { public static void main(String[] args) throws Exception { int charCount = 0; for (int timesToTry = 0;timesToTry < 3; timesToTry++) { long startTime = System.currentTimeMillis(); // // unbuffered IO // FileReader fr = new FileReader("C:/Users/demo/TextTwist/src/WORD.LST"); // for (int c = fr.read();c != -1;c = fr.read()) { // charCount++; // } // fr.close(); // // unbuffered IO // FileReader fr = new FileReader("C:/Users/demo/TextTwist/src/WORD.LST"); // char[] buffer = new char[5*1024]; // for (int bytesRead = fr.read(buffer);bytesRead != -1;bytesRead = fr.read(buffer)) { // charCount += bytesRead; // } // fr.close(); // // unbuffered IO with just bytse // FileInputStream fr = new FileInputStream("C:/Users/demo/TextTwist/src/WORD.LST"); // byte[] buffer = new byte[5*1024]; // for (int bytesRead = fr.read(buffer);bytesRead != -1;bytesRead = fr.read(buffer)) { // charCount += bytesRead; // for (int i=0;i