Read the file one buffer at a time : FileReader « File « Java Tutorial






import java.io.FileReader;

public class Main {
  public static void main(String[] argv) throws Exception {
    FileReader fr = new FileReader("text.txt");
    int count;
    char chrs[] = new char[80];

    do {
      count = fr.read(chrs);
      for (int i = 0; i < count; i++)
        System.out.print(chrs[i]);
    } while (count != -1);

  }
}








11.30.FileReader
11.30.1.FileReader
11.30.2.Use a FileReader to display a text file.
11.30.3.Read the file one buffer at a time
11.30.4.Read file upside down
11.30.5.Loading text from a file
11.30.6.Wrap FileReader with BufferedReader