Solved

Could someone explain EOFException and FileNotFoundException?

Posted on 2004-04-21
9
352 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Java virtual machine monitoring tools 3 39
scoreUp challenge 14 48
noX challenge 17 76
Running Jira on Raspberry PI 2? 3 130
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…
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 will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

758 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

25 Experts available now in Live!

Get 1:1 Help Now