I/O Exceptions
Home ] Up ] Files and Directories ] [ I/O Exceptions ] Streams and Stream Classification ] Character Streams ] Byte Streams ] Data Conversion Streams ] Filter Streams ] Message Formatting ] Tokenizers ] Zip & Jar Files ] Random Access ]

 

 

If you look in package java.io, you'll find a family of IOExceptions:

(Package java.io)

Object
    Throwable
        Exception
            IOException
                CharConversionException
                EOFException
                FileNotFoundException
                InterruptedIOException
                ObjectStreamException
                    InvalidClassException
                    InvalidObjectException
                    NotActiveException
                    NotSerializableException
                    OptionalDataException
                    StreamCorruptedException
                    WriteAbortedException
                SyncFailedException
                UnsupportedEncodingException
                UTFDataFormatException

The exceptions you're likely to encounter the most are:

  • EOFException -- Signals that an end of file or end of stream has been reached unexpectedly during input.
    (This exception is mainly used by data input streams, which generally expect a binary file in a specific format, and for which an end of stream is an unusual condition. Most other input streams return a special value on end of stream.)
  • FileNotFoundException -- Signals that a file could not be found.
  • IOException -- Signals that an I/O exception of some sort has occurred.
    (This is the 'catch-all' exception which is used a lot because a number of methods each specify that it throws IOException .

The other exceptions in the IOException family are rather specific and/or fairly rare.

 
The page was last updated February 19, 2008