This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes I/O stream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I/O stream " Watch "I/O stream " New topic
Author

I/O stream

Preet Dhillon
Greenhorn

Joined: May 20, 2008
Posts: 24

In the code above - I am trying to replace the Arrays.asList parameters to a text file





What method of file I/O stream should I be using for this purpose. Aslo, can it return a List<String> stooges from this method?

Thank you!
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4164
    
  21

There is no single method that you can can use to read a bunch of values from a file and turn them into a List<String>. You will have to go through the process of reading the lines, parsing the values and putting the values into the List. See the IO tutorial for help. Depending on the actual format of the file, parsing may not be as simple as it appears, so using a library which knows how to parse the format might help. For some example libraries that could be useful see our AccessingFileFormats (<= link) FAQ.


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I/O stream
 
Similar Threads
String array to arraylist
why the list size is 1
Output???
ClassCastException
What is the List class