Java Reference
In-Depth Information
public void trimToSize()
Trims the capacity of the calling object to be the calling object's current size. This is used to
save storage.
MAKE A COPY
public Object clone()
Returns a shallow copy of the calling object.
Boolean
This is a wrapper class for boolean . See Section 5.1 in Chapter 5 .
BufferedReader
Package: java.io
The FileReader class is also in this package.
Ancestor classes:
Object
|
+--Reader
|
+--BufferedReader
public BufferedReader(Reader readerObject)
This is the only constructor you are likely to need. There is no constructor that accepts a fi le
name as an argument. If you want to create a stream using a fi le name, use
new BufferedReader( new FileReader( File_Name ))
When used in this way, the FileReader constructor, and thus the BufferedReader constructor
invocation, can throw a FileNotFoundException , which is a kind of IOException .
If you want to create a stream using an object of the class File , use
new BufferedReader( new FileReader( File_Object ))
When used in this way, the FileReader constructor, and thus the BufferedReader constructor
invocation, can throw a FileNotFoundException , which is a kind of IOException.
public void close() throws IOException
Closes the stream's connection to a fi le.
public int read() throws IOException
Reads a single character from the input stream and returns that character as an int value. If the
read goes beyond the end of the fi le, then −1 is returned. Note that the value is returned as an
int . To obtain a char , you must perform a type cast on the value returned. The end of a fi le is
signaled by returning −1 . (All of the “real” characters return a positive integer.)
 
Search WWH ::




Custom Search