Java Reference
In-Depth Information
Display 10.15 Some Methods in the Class ObjectInputStream (part 2 of 3)
public long readLong() throws IOException
Reads a long value from the input stream and returns that long value. If readLong tries to read a
value from the file and that value was not written using the method writeLong 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 file, an EOFException is thrown.
public double readDouble() throws IOException
Reads a double value from the input stream and returns that double value. If readDouble tries to
read a value from the file and that value was not written using the method writeDouble 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 file, an EOFException is thrown.
public float readFloat() throws IOException
Reads a float value from the input stream and returns that float value. If readFloat tries to read
a value from the file and that value was not written using the method writeFloat 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 file, an EOFException is thrown.
public char readChar() throws IOException
Reads a char value from the input stream and returns that char value. If readChar tries to read a
value from the file and that value was not written using the method writeChar 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 file, an EOFException is thrown.
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 file 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 file, an EOFException is thrown.
public String readUTF() throws IOException
Reads a String value from the input stream and returns that String value. If readUTF tries to read
a value from the file and that value was not written using the method writeUTF 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 file, an EOFException is thrown.
Object readObject( ) throws ClassNotFoundException, IOException
Reads an object from the input stream. The object read should have been written using write-
Object of the class ObjectOutputStream . Throws a ClassNotFoundException if a serialized
object cannot be found. If an attempt is made to read beyond the end of the file, an EOFException
is thrown. May throw various other IOException s.
Search WWH ::




Custom Search