FileReader (Java Platform SE 8 ) (original) (raw)
- java.io.Reader
- java.io.InputStreamReader
- java.io.FileReader
- java.io.InputStreamReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable
public class FileReader
extends InputStreamReader
Convenience class for reading character files. The constructors of this class assume that the default character encoding and the default byte-buffer size are appropriate. To specify these values yourself, construct an InputStreamReader on a FileInputStream.FileReader
is meant for reading streams of characters. For reading streams of raw bytes, consider using aFileInputStream
.
Since:
JDK1.1
See Also:
InputStreamReader, FileInputStream
Field Summary
* ### Fields inherited from class java.io.[Reader](../../java/io/Reader.html "class in java.io") `[lock](../../java/io/Reader.html#lock)`
Constructor Summary
Constructors
Constructor Description FileReader(File file) Creates a new FileReader, given the File to read from. FileReader(FileDescriptor fd) Creates a new FileReader, given theFileDescriptor to read from. FileReader(String fileName) Creates a new FileReader, given the name of the file to read from. Method Summary
* ### Methods inherited from class java.io.[InputStreamReader](../../java/io/InputStreamReader.html "class in java.io") `[close](../../java/io/InputStreamReader.html#close--), [getEncoding](../../java/io/InputStreamReader.html#getEncoding--), [read](../../java/io/InputStreamReader.html#read--), [read](../../java/io/InputStreamReader.html#read-char:A-int-int-), [ready](../../java/io/InputStreamReader.html#ready--)` * ### Methods inherited from class java.io.[Reader](../../java/io/Reader.html "class in java.io") `[mark](../../java/io/Reader.html#mark-int-), [markSupported](../../java/io/Reader.html#markSupported--), [read](../../java/io/Reader.html#read-char:A-), [read](../../java/io/Reader.html#read-java.nio.CharBuffer-), [reset](../../java/io/Reader.html#reset--), [skip](../../java/io/Reader.html#skip-long-)` * ### Methods inherited from class java.lang.[Object](../../java/lang/Object.html "class in java.lang") `[clone](../../java/lang/Object.html#clone--), [equals](../../java/lang/Object.html#equals-java.lang.Object-), [finalize](../../java/lang/Object.html#finalize--), [getClass](../../java/lang/Object.html#getClass--), [hashCode](../../java/lang/Object.html#hashCode--), [notify](../../java/lang/Object.html#notify--), [notifyAll](../../java/lang/Object.html#notifyAll--), [toString](../../java/lang/Object.html#toString--), [wait](../../java/lang/Object.html#wait--), [wait](../../java/lang/Object.html#wait-long-), [wait](../../java/lang/Object.html#wait-long-int-)`
Constructor Detail
* #### FileReader public FileReader([String](../../java/lang/String.html "class in java.lang") fileName) throws [FileNotFoundException](../../java/io/FileNotFoundException.html "class in java.io") Creates a new FileReader , given the name of the file to read from. Parameters: `fileName` \- the name of the file to read from Throws: `[FileNotFoundException](../../java/io/FileNotFoundException.html "class in java.io")` \- 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. * #### FileReader public FileReader([File](../../java/io/File.html "class in java.io") file) throws [FileNotFoundException](../../java/io/FileNotFoundException.html "class in java.io") Creates a new FileReader , given the File to read from. Parameters: `file` \- the File to read from Throws: `[FileNotFoundException](../../java/io/FileNotFoundException.html "class in java.io")` \- if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading. * #### FileReader public FileReader([FileDescriptor](../../java/io/FileDescriptor.html "class in java.io") fd) Creates a new FileReader , given the FileDescriptor to read from. Parameters: `fd` \- the FileDescriptor to read from
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.