Class Overview
A specialized Reader
that reads from a file in the file system.
All read requests made by calling methods in this class are directly
forwarded to the equivalent function of the underlying operating system.
Since this may induce some performance penalty, in particular if many small
read requests are made, a FileReader is often wrapped by a
BufferedReader.
Summary
[Expand]
Inherited Methods |
From class
java.io.InputStreamReader
|
From class
java.io.Reader
abstract
void
|
close()
Closes this reader.
|
void
|
mark(int readLimit)
Sets a mark position in this reader.
|
boolean
|
markSupported()
Indicates whether this reader supports the mark() and
reset() methods.
|
int
|
read()
Reads a single character from this reader and returns it as an integer
with the two higher-order bytes set to 0.
|
abstract
int
|
read(char[] buffer, int offset, int count)
Reads up to count characters from this reader and stores them
at offset in the character array buffer .
|
int
|
read(CharBuffer target)
Reads characters and puts them into the target character buffer.
|
int
|
read(char[] buffer)
Reads characters from this reader and stores them in the character array
buffer starting at offset 0.
|
boolean
|
ready()
Indicates whether this reader is ready to be read without blocking.
|
void
|
reset()
Resets this reader's position to the last mark() location.
|
long
|
skip(long charCount)
Skips charCount characters in this reader.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
From interface
java.io.Closeable
abstract
void
|
close()
Closes the object and release any system resources it holds.
|
|
From interface
java.lang.AutoCloseable
abstract
void
|
close()
Closes the object and release any system resources it holds.
|
|
From interface
java.lang.Readable
abstract
int
|
read(CharBuffer cb)
Reads characters into the specified CharBuffer .
|
|
Public Constructors
public
FileReader
(File file)
Constructs a new FileReader on the given file
.
Parameters
file
| a File to be opened for reading characters from. |
Construct a new FileReader on the given FileDescriptor fd
. Since
a previously opened FileDescriptor is passed as an argument, no
FileNotFoundException can be thrown.
Parameters
fd
| the previously opened file descriptor.
|
public
FileReader
(String filename)
Construct a new FileReader on the given file named filename
.
Parameters
filename
| an absolute or relative path specifying the file to open. |