FileReader
Stay organized with collections
Save and categorize content based on your preferences.
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 a
FileInputStream
.
Public Constructor Summary
|
FileReader( String fileName)
Creates a new FileReader, given the name of the
file to read from.
|
|
FileReader( File file)
Creates a new FileReader, given the File
to read from.
|
|
|
Inherited Method Summary
From class
java.io.Reader
abstract
void
|
close()
Closes the stream and releases any system resources associated with
it.
|
void
|
mark(int readAheadLimit)
Marks the present position in the stream.
|
boolean
|
markSupported()
Tells whether this stream supports the mark() operation.
|
int
|
read()
Reads a single character.
|
abstract
int
|
read(char[] cbuf, int off, int len)
Reads characters into a portion of an array.
|
int
|
read(char[] cbuf)
Reads characters into an array.
|
int
|
read( CharBuffer target)
Attempts to read characters into the specified character buffer.
|
boolean
|
ready()
Tells whether this stream is ready to be read.
|
void
|
reset()
Resets the stream.
|
long
|
skip(long n)
Skips characters.
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals( Object obj)
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(long timeout, 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 timeout)
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()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
From interface
java.io.Closeable
abstract
void
|
close()
Closes this stream and releases any system resources associated
with it.
|
Public Constructors
public
FileReader
(String fileName)
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 |
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)
Creates a new FileReader, given the File
to read from.
Parameters
file |
the File to read from |
Throws
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.
|
Creates a new FileReader, given the
FileDescriptor to read from.
Parameters
fd |
the FileDescriptor to read from
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-07-10 UTC."}