This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Attempting to Copy Files using Threads...

 
Abhijit Kolhatkar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Attempting to Read a file and write it using Thread
Following is my implementation:



in_file and out_file are obtained as below: (In the Constructor of the Thread Class.



Now, following is the code in the main method of CopyFiles class which runs this Thread:



In place of INPUTFILE and OUTPUTFILE I have given FULL PATH of the files.

My input file is having only 5 rows as below:

The code is excuting without errors but NONE OF THE ROWS is getting written..
I have checked by debugging the code in Eclipse and even the While loop in RUN method is working but no out put is getting written....
Can someone point out the problem??

Thanks
 
Abhijit Kolhatkar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahhhh.....
My appologies...
The code was behaving like that because I DIDNT CLOSE THE STREAMS AFTER THE LOOP....
By putting the statements:



I was able to make the code work...

Moderators/Admins....Will you kindly close this thread?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic