Solved

Could someone explain EOFException and FileNotFoundException?

Posted on 2004-04-21
9
360 Views
Last Modified: 2008-03-17
which JAVA library it belongs to? which class are they subclasses of?
0
Comment
Question by:aquemini001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 10885605
package java.io
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 10885613
When ever you try to open a file which does not exists, application throws FileNotFoundException
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 10885668
package java.io is used to handle IO Streams and files.

 When ever you try to open a file which does not exists, application throws FileNotFoundException

While reading the file through IO classes, if the stream pointer excceeds the beyond the length of file,

EOFException will be raised. Generally this exception will be raised when you works with RandomAccessFile
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 20 total points
ID: 10885690
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.

Note that some input operations react to end-of-file by returning a distinguished value (such as -1) rather than by throwing an exception.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 10885693
The java.io package contains the fundamental classes for performing input and output operations in Java. These I/O classes can be divided into four basic groups:

    * Classes for reading input from a stream.

    * Classes for writing output to a stream.

    * Classes for manipulating files.

    * Classes for serializing objects.

All fundamental I/O in Java is based on streams. A stream represents a flow of data, or a channel of communication. Conceptually, there is a reading process at one end of the stream and a writing process at the other end. Java 1.0 supported only byte streams, which meant that Unicode characters were not always handled correctly. As of Java 1.1, there are classes in java.io for both byte streams and character streams. The character stream classes, which are called readers and writers, handle Unicode characters appropriately.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10885834
Java has two different packages for IO.

One is java.io and the other is java.nio (from jdk 1.4.*).  

Other part you can follow sudhakar.



Regards,
Muruga
0
 
LVL 15

Expert Comment

by:JakobA
ID: 10886742
the below 'inheritace list' is from the page http://java.sun.com/j2se/1.4.2/docs/api/java/io/EOFException.html
I found it by searching for two words:
      eofException java
on google

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.io.IOException
              extended byjava.io.EOFException
0
 

Author Comment

by:aquemini001
ID: 10893223
Thanks for the assistance. Good answers.
0
 

Author Comment

by:aquemini001
ID: 10973441
So would i be correct in sying that they are members of the "java.lang" library and they are subclasses of the "java.io" class?? I need to know which library they are members of AND which class are they subclasses of. Or am i sayin g the same thing  by asking which library they are a member of and which subclass?
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question