rahul arno wrote:we normally save text data in .txt file using serialization.
You do? Seems like a mighty odd way to do it to me.
If you literallly just want to copy the contents of the file blindly, then:
1. If you're on Java v6 or earlier, just open a FileInputStream and FileOutputStream to the relevant names and loop through the contents with
read() and
write(). There may even be slicker solutions available.
2. If you're on Java v7, use
Files.copy().
But I suspect that Guillaume is right, and that you actually have something different in mind; but until you tell us what that is, it's difficult to advise.
Winston