Java Reference
In-Depth Information
public
V remove(Object key)
(Optional)
Removes the mapping for the specifi ed key. If the key is not found in the map, then
null
is
returned, otherwise the previous value for the key is returned.
Throws:
ClassCastException
if the type of
key
is incompatible with the type for this map (optional).
NullPointerException
if the key is
null
and this map does not permit
null
keys (optional).
UnsupportedOperationException
if the remove operation is not supported by this
map (optional).
ObjectInputStream
Package:
java.io
The FileInputStream
class is also in this package.
Ancestor classes:
Object
|
+--InputStream
|
+--ObjectInputStream
public
ObjectInputStream(InputStream streamObject)
There is no constructor that takes a fi le name as an argument. If you want to create a stream
using a fi le name, use
new
ObjectInputStream(
new
FileInputStream(
File_Name
))
Alternatively, you can use an object of the class
File
in place of the
File_Name
,
as follows:
new
ObjectInputStream(
new
FileInputStream(
File_Object
))
The constructor for
FileInputStream
may throw a
FileNotFoundException
, which is a
kind of
IOException
. If the
FileInputStream
constructor succeeds, then the constructor for
ObjectInputStream
may throw a different
IOException
.
public void
close()
throws
IOException
Closes the stream's connection to a fi le.
public boolean
readBoolean()
throws
IOException
Reads a
boolean
value from the input stream and returns that
boolean
value. If
readBoolean
tries to read a value from the fi le and that value was not written using the method
writeBoolean
of the class
ObjectOutputStream
(or written in some equivalent way), then
problems will occur.
If an attempt is made to read beyond the end of the fi le, an
EOFException
is thrown.