File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Vector and file read problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Vector and file read problem" Watch "Vector and file read problem" New topic

Vector and file read problem

vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
well i have a file say list.ini and following are the contents (contents might grow also..)
so my problem i need to read these values from this file and store it in a vector!!!pls give me an idea on how to do it?

SCJP, SCWD <br />A farmer learns more from a bad harvest than a good one.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Since a vector is declared to hold objects, you have to convert each of them to an object first. If your numbers are ints, convert them to an Integer, if they are longs converts them to Long.
You can just wrap them like this...
Long aLong = new Long(yourNumber)

So much trouble in the world -- Bob Marley
Thomas Smets
Ranch Hand

Joined: Dec 11, 2001
Posts: 111
It's not reading into a Vector but it is very close ! See this

Thomas Smets
Just another developper
I agree. Here's the link:
subject: Vector and file read problem
It's not a secret anymore!