Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Could someone explain EOFException and FileNotFoundException?

Posted on 2004-04-21
9
Medium Priority
?
365 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
Technology Partners: 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 80 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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

886 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