aspose file tools*
The moose likes Java in General and the fly likes read a file ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "read a file ?" Watch "read a file ?" New topic
Author

read a file ?

sam robert
Greenhorn

Joined: Oct 04, 2004
Posts: 4
Hi all,

I am trying to develop a small application. I have a set of questions in a file and i need to read these from the file, as question by question an dneed to display them on the screen at the same time. I? am quite new to this. Can someone please help.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Step to develop your program.

1. read all data in file.
2. Parse all data in to some Bean class to display and keep bean in List/Vector.
3. Display all data in List/Vector to screen/UI.


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Example Read data in File

Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
sam,
You can also search old posts, which are related to file accessing, using the keyword "file" in this forum...

I do believe some old posts are pretty useful for us to get to know about the things that we are willing to know...

Hope it helps...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
sam robert
Greenhorn

Joined: Oct 04, 2004
Posts: 4
thanks guys ...but i am still not clear as to how do i store the read part in a vector ....please explain that ....i appreciate it....
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

Since you want to display the read question on the screen at the same time , why do you need a vector. You could print the read question immediately without requiring any temporaty storage.


Groovy
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by sam robert:
thanks guys ...but i am still not clear as to how do i store the read part in a vector ....please explain that ....i appreciate it....


sam, if you want to keep all the lines in a vector, you can modify somkit's code as the following... As Pradeep mentioned, if you are directly printing the contents of the file to the console screen, you don't need a vector to store them... But if you want to use them in the future, you might need it...



Hope it helps...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: read a file ?
 
Similar Threads
Reading PDF from Java
Hi Need suggestions
To read an ini file
delete method in B & S
Authentification in my webapp