Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-26-2007, 11:13 PM
Member
 
Join Date: Nov 2007
Posts: 13
Camden is on a distinguished road
Exception
im using this to read a text file
Code:
try{ blah blah while((inputFile = br.readLine()) != null ) {
but im thinking that if there is a null or more sentences (e.g. between the title and the first paragraph) then it gonna stop reading.. what should i do? throw an exception and make it go back to
Code:
try{
? and how? thanx

Last edited by Camden : 11-26-2007 at 11:16 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-27-2007, 12:16 AM
Member
 
Join Date: Nov 2007
Posts: 13
Camden is on a distinguished road
anyone?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 11-27-2007, 12:50 AM
Senior Member
 
Join Date: Jul 2007
Posts: 1,191
hardwired is on a distinguished road
but im thinking that if there is a null or more sentences (e.g. between the title and the first paragraph) then it gonna stop reading.. what should i do? throw an exception and make it go back to
I'm not sure what you mean by this: "a null or more sentences".
The reader will go on reading until it reaches the end of the file (EOF). When it does it returns "null". With the code you have your while loop will exit gracefully because its listening for this eof condition. If the reader encounters empty lines in the file it will read/return those okay.
Of course you can always whip up a short test app and a file to read and play around with this to find out how it works and what does/doesn't work.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where does the exception go? aytidaalkuhs New To Java 3 04-07-2008 03:24 PM
exception Oktam New To Java 2 03-23-2008 08:01 PM
Trouble with factory method - unhandled exception type Exception desmond5 New To Java 1 03-08-2008 07:41 PM
Need help on Exception Deon New To Java 5 01-26-2008 09:27 AM
JSP Exception Hanling Java Tip Java Tips 0 12-24-2007 10:57 AM


All times are GMT +3. The time now is 10:51 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org