File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the total no. of Lines of a text file

 
Mullin Yu
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as subject!
 
Stuart Gray
Ranch Hand
Posts: 410
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using the LineNumberReader class. Set it up something like this:

Then keep calling readLine() to read each line as a String, and getLineNumber() to determine which line you are on (note it starts counting at zero).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic