aspose file tools*
The moose likes Beginning Java and the fly likes Reading File into an array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Reading File into an array" Watch "Reading File into an array" New topic
Author

Reading File into an array

Berty Ahern
Greenhorn

Joined: Mar 03, 2005
Posts: 17
Hi, I want to load a persons details into an array from a text file so that I can then put that info into textfields, edit it and then some how save it into the file again. Can anyone supply me with some sample code of how i should do this?
Thanks in advance,
Berty
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
I would recommend starting with Sun's I/O streams tutorials. They're quite good and will give you a good understanding of the basics. Then make an attempt to write the code yourself (there's no better way to learn), and come back here to post specific questions and get help with non-working code.
Berty Ahern
Greenhorn

Joined: Mar 03, 2005
Posts: 17
Well I have the I/O stream set up and its working with text fields its just that i can't figure out how to stick it into an array. I'll do more researcch...
TTFN
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Do you want to read the file's contents into a byte array? That wouldn't be very convenient for putting elsewhere. Can you explain exactly what you want to do? Be as specific as possible since the compiler will require you to be when coding.
Berty Ahern
Greenhorn

Joined: Mar 03, 2005
Posts: 17
Well I'm kinda getting the file like this:

The information would be in String type, would it be possible to get that into a byte array?
Cheers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading File into an array