Results 1 to 4 of 4
- 12-29-2011, 12:19 AM #1
Member
- Join Date
- Jul 2011
- Posts
- 21
- Rep Power
- 0
Help needed to read/get information from a text file plz
I have a class actor which holds two instance variables: 'String name' and 'ArrayList<String> movie_titles'
To define these variables I will need to import the information from a file which has the following structure:
Attachment 2425
etc...
Any ideas on how I could do this anyone? Or any links as to where I can learn how to do this would be really helpful, thank you all so much
- 12-29-2011, 12:23 AM #2
Re: Help needed to read/get information from a text file plz
First you will need to read the lines from the file into your program as Strings.
The Scanner class will help you do that.
Once you can read the lines from the file, you will need to "parse" the lines to extract the information you want to save. To do this "parsing" you will need to understand where the data is that you want to save. You will need some "rules" that define where in the lines the data is. For example some lines start in the first character of the line and some lines have leading spaces.
- 12-29-2011, 12:37 AM #3
Member
- Join Date
- Oct 2011
- Posts
- 15
- Rep Power
- 0
Re: Help needed to read/get information from a text file plz
You may find these useful:
Dystopian Code: Text File I/O in Java
Dystopian Code: Text File I/O with Strings that Contain Spaces in Java
- 12-29-2011, 01:15 AM #4
Member
- Join Date
- Jul 2011
- Posts
- 21
- Rep Power
- 0
Similar Threads
-
how to read a file for information from java main function??
By nilo in forum JCreatorReplies: 1Last Post: 01-10-2012, 12:49 PM -
How to read currency money from Notpade instead of read all information from web
By Albert050 in forum NetBeansReplies: 0Last Post: 11-15-2011, 09:13 PM -
need to read information from file into array
By sadeem in forum New To JavaReplies: 8Last Post: 05-15-2011, 10:00 PM -
Help needed: read array from file and then use it
By ChicagoAve in forum New To JavaReplies: 11Last Post: 02-18-2011, 01:02 PM -
Readin from a file. and storing the information. (read inside)
By Rock-On in forum New To JavaReplies: 2Last Post: 11-29-2009, 10:26 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks