This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell 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

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: 61314

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

Joined: Jul 08, 2003
Posts: 24187

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]
GeeCON Prague 2014
subject: File Reader