permaculture playing cards
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I/O stream " Watch "I/O stream " New topic

I/O stream

Preet Dhillon

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

Joined: Jan 28, 2003
Posts: 4181

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.

I agree. Here's the link:
subject: I/O stream
It's not a secret anymore!