Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Read the begining of file agian

807605Aug 18 2007 — edited Aug 18 2007
Hi,

I try to read file line be line and store some value that beginning with special expression. The problem that i need to read the file again from the beginning after finish the first time.

My Code(procedure):
IFL ifl = new IFL();

BufferedReader input; 		
String Regex[] = {"Favorite:","FullPAth:","Date:","Rating:","Comment:"};     	
int c1=0;
String Fav[] = new String [(ifl.NOF(UserProfile)*4)+ifl.NOF(UserProfile)];
String aLine1 = null;
for (int i=0; i<5; i++){    		
 input = new BufferedReader(new
 FileReader("IFL\\User_Profile\\"+UserProfile+".dat"));
 Pattern pattern = Pattern.compile(Regex.toString()); 		
while((aLine1 = input.readLine()) != null) {
Matcher m1 = pattern.matcher(aLine1);
if (m1.find()){
Fav[c1] = aLine1.substring(m1.end());
c1++;
}
}
input.close();
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 15 2007
Added on Aug 18 2007
2 comments
138 views