Closeable
, AutoCloseable
, Readable
public class FileReader extends InputStreamReader
The FileReader
is meant for reading streams of characters. For reading streams of raw bytes, consider using a FileInputStream
.
Constructor | Description |
---|---|
FileReader |
|
FileReader |
|
FileReader |
|
FileReader |
Creates a new FileReader , given the name of the file to read, using the default charset. |
FileReader |
Creates a new FileReader , given the name of the file to read and the charset. |
close, getEncoding, read, read, ready
mark, markSupported, nullReader, read, read, reset, skip, transferTo
public FileReader(String fileName) throws FileNotFoundException
FileReader
, given the name of the file to read, using the default charset.fileName
- the name of the file to readFileNotFoundException
- if the named file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.public FileReader(File file) throws FileNotFoundException
file
- the File
to readFileNotFoundException
- if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.public FileReader(FileDescriptor fd)
fd
- the FileDescriptor
to readpublic FileReader(String fileName, Charset charset) throws IOException
FileReader
, given the name of the file to read and the charset.fileName
- the name of the file to readcharset
- the charset
IOException
- if the named file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.public FileReader(File file, Charset charset) throws IOException
file
- the File
to readcharset
- the charset
IOException
- if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/FileReader.html