• Post Reply Bookmark Topic Watch Topic
  • New Topic

Important!  RSS feed

 
Jimi Rock
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would be grateful if some one could tell me how can I read a "textual" input file word by word, and then write its contents word by word also to another file of type "html".
I need the program to search the input file, when it finds the word "java", it is going to make it as a link to a certain url in the output html file.
Initially, I would like to know if I could read file word by word not char by char and write it contents to another file word by word also.
Regards,
Jimi.
 
mani suri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Jimi,
I think your problem can be solved by using a file input stream and specifying two java delimiters one as tab that means change of word and the other delimiter it will read as change of line automatically .
You just type in any number of words u want specify it as source file and with the output stream place it where u want to place .
I think small application prog will do for u . I remeber doing this long time ago about a similar application .
Go through java io streams ... and take String Buffer class and place each line in that buffer and split each word according to delimitor u want......... hope fully u got it .
with regards
Ankur
mail me if required
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jimi,
I think the best you can do is read the file line by line using BufferedReader.readLine() method. Then you can use StringTokenizer to parse it into words using space as delimeter.
Just my $.02 ...
Regards,
Manfred.
 
Jimi Rock
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ankur and Manfred...
I would be grateful if some one could provide me with a segment of code that is supposed to do the job. I think it is easy but because I am not familier with files and streams
Currently I have the code that reads the file char by char. but I need to change a whole word to be a link as I have specified.
If the code I have is required, I am going to post it..just tell please.
Thanks again...
Jimi.
 
Jimi Rock
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Problem is solved.
Thanks for all of your efforts...
Regards,
Jimi.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!