Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

How to deal with Empty line followed by a content in ASC file  RSS feed

 
vikram nalagampalli
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am trying to read a text file, which has emplty lines in between and followed by text. I am encountering null pointer exception, whenever my readLine sees empty line.
I am wondering if there is way to tackle this, so that that this empty space is ignored and it will proceed to next line.
I am actually using POI from jakarta to read Excel directly. I was trying to find a solution for text file and found this instead which has methd that gives the last row in excel. That way i know the End of File.
But this problem to deal with Blank lines in between continues to haunt me. i am wondering if some one can help me with providing some insight into this.
Really appreciate your help.
Thanks
Vik
 
Joe Ess
Bartender
Posts: 9428
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Is this a continuation of this thread or are we talking about something different? Be a little clearer about your problem. Are you having a problem with reading an Excel file or a text file? It would be nice if you would share the code you are working with and the stack trace of the exception, too.
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Report post to moderator
The question appears to be directly related to the one you pointed to, Joe. In fact, you provide an excellent solution to the problem already.
Vikram, follow Joe's link and read his answer. Closing this thread.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!