FileReader (Java Platform SE 7 ) (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 and 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%28%29), [getEncoding](../../java/io/InputStreamReader.html#getEncoding%28%29), [read](../../java/io/InputStreamReader.html#read%28%29), [read](../../java/io/InputStreamReader.html#read%28char[],%20int,%20int%29), [ready](../../java/io/InputStreamReader.html#ready%28%29)` * ### Methods inherited from class java.io.[Reader](../../java/io/Reader.html "class in java.io") `[mark](../../java/io/Reader.html#mark%28int%29), [markSupported](../../java/io/Reader.html#markSupported%28%29), [read](../../java/io/Reader.html#read%28char[]%29), [read](../../java/io/Reader.html#read%28java.nio.CharBuffer%29), [reset](../../java/io/Reader.html#reset%28%29), [skip](../../java/io/Reader.html#skip%28long%29)` * ### Methods inherited from class java.lang.[Object](../../java/lang/Object.html "class in java.lang") `[clone](../../java/lang/Object.html#clone%28%29), [equals](../../java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../java/lang/Object.html#finalize%28%29), [getClass](../../java/lang/Object.html#getClass%28%29), [hashCode](../../java/lang/Object.html#hashCode%28%29), [notify](../../java/lang/Object.html#notify%28%29), [notifyAll](../../java/lang/Object.html#notifyAll%28%29), [toString](../../java/lang/Object.html#toString%28%29), [wait](../../java/lang/Object.html#wait%28%29), [wait](../../java/lang/Object.html#wait%28long%29), [wait](../../java/lang/Object.html#wait%28long,%20int%29)`
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, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.