Maybe you should open a stream reading the original file
the open a writing stream for the copy file
And reading from one, writing on the other, replacing what you need in the intermediate collection of bytes/characters
���