Solved

Could someone explain EOFException and FileNotFoundException?

Posted on 2004-04-21
9
353 Views
Last Modified: 2008-03-17
which JAVA library it belongs to? which class are they subclasses of?
0
Comment
Question by:aquemini001
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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now