Top Description Constructors Methods
java.io

public Class FileReader

extends InputStreamReader
Class Inheritance
Imports
java.nio.charset.Charset

Reads text from character files using a default buffer size. Decoding from bytes to characters uses either a specified charset or the default charset.

The FileReader is meant for reading streams of characters. For reading streams of raw bytes, consider using a FileInputStream.

Author
Mark Reinhold
Since
1.1
See Also
InputStreamReader, FileInputStream, Charset#defaultCharset()

Constructor Summary

AccessConstructor and Description
public
FileReader(String
the name of the file to read
fileName
)

Creates a new FileReader, given the name of the file to read, using the default charset.

public
FileReader(File
the File to read
file
)

Creates a new FileReader, given the File to read, using the default charset.

public
FileReader(FileDescriptor
the FileDescriptor to read
fd
)

Creates a new FileReader, given the FileDescriptor to read, using the default charset.

public
FileReader(String
the name of the file to read
fileName
,
Charset charset)

Creates a new FileReader, given the name of the file to read and the charset.

public
FileReader(File
the File to read
file
,
Charset charset)

Creates a new FileReader, given the File to read and the charset.

Method Summary

Inherited from java.io.InputStreamReader:
closegetEncodingreadreadreadready

Constructor Detail

FileReaderback to summary
public FileReader(String fileName) throws FileNotFoundException

Creates a new FileReader, given the name of the file to read, using the default charset.

Parameters
fileName:String

the name of the file to read

Exceptions
FileNotFoundException:
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.
See Also
Charset#defaultCharset()
FileReaderback to summary
public FileReader(File file) throws FileNotFoundException

Creates a new FileReader, given the File to read, using the default charset.

Parameters
file:File

the File to read

Exceptions
FileNotFoundException:
if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
See Also
Charset#defaultCharset()
FileReaderback to summary
public FileReader(FileDescriptor fd)

Creates a new FileReader, given the FileDescriptor to read, using the default charset.

Parameters
fd:FileDescriptor

the FileDescriptor to read

See Also
Charset#defaultCharset()
FileReaderback to summary
public FileReader(String fileName, Charset charset) throws IOException

Creates a new FileReader, given the name of the file to read and the charset.

Parameters
fileName:String

the name of the file to read

charset:Charset

the charset

Exceptions
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.
Since
11
FileReaderback to summary
public FileReader(File file, Charset charset) throws IOException

Creates a new FileReader, given the File to read and the charset.

Parameters
file:File

the File to read

charset:Charset

the charset

Exceptions
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.
Since
11