Home >Java >javaTutorial >Using a FileReader

Using a FileReader

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-11-14 09:16:01214browse
  • The FileReader class creates a Reader object used to read the contents of a file.

  • The most common constructor is FileReader(String filename).

  • This constructor throws the FileNotFoundException exception if the file does not exist.

  • FileReader is derived from InputStreamReader and Reader, inheriting their methods.

Usando um FileReader

  • FileReader is encapsulated in a BufferedReader.
    Encapsulation allows access to the readLine() method, which reads lines from the file.

  • Closing BufferedReader (br) automatically closes the associated file.

The above is the detailed content of Using a FileReader. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn