This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes File Reader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "File Reader" Watch "File Reader" New topic
Author

File Reader

Raghavendra U Ganiga
Greenhorn

Joined: Jan 23, 2006
Posts: 5
Hi Friends,

i want know how to read a particular line in a text file using JSP's file reader option.

Raghav
:roll:


Raghavendra U
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

What file reader option?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Raghavendra U Ganiga
Greenhorn

Joined: Jan 23, 2006
Posts: 5
Hi
it may be any type of file reader or buffer reader option which is suitable.

Regards
Raghav
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

JSP has no special facilities for reading files once you have determined their path. So I've moved this to the I/O forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Assuming lines of unequal length, the only way to read a particular line in a file in Java is to read all the data before the line, then read the line. For example,



I've skipped error handling entirely here -- you want to check readLine() for a null return whenever you call it, because it means you've hit end-of-file.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File Reader
 
Similar Threads
SCJP 6 (or, rather, No SCJP 6)
IO Question from javacaps
File IO
File Reader
Little help with reading files