Meaningless Drivel is fun!
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
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "File Reader" Watch "File Reader" New topic

File Reader

Raghavendra U Ganiga

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.


Raghavendra U
Ben Souther

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

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

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

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] [About Bear] [Books by Bear]
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

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:
subject: File Reader
It's not a secret anymore!