wood burning stoves 2.0*
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
Author

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..)
10002
10009
30000
40000
500000
600000
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)


Bosun (SCJP, SCWCD)
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,


Thomas Smets
Just another developper
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Vector and file read problem
 
Similar Threads
Error in Servlet compilation
Writing to a file on the server whose URL is given
struggling with vectors
idea for this pls?!
How do I write contents of a vector to file?