I am experimenting with using the basic IO classes needed for the SCJP exam. I am trying to read the contents of one file using FileReader and BufferedReader, and then write this to another file using PrintWriter. However, whether I use the println() or the print() method of PrintWriter, I am getting extra characters at the end of each line. They are showing up in notepad++ as square boxes when I use println() and little null graphics when I use print(). I have tried a basic text editor like plain notepad and it's the same story there.
I have googled and think it might have something to do with an extra '\n' character when I use println. If this is the case though I would have thought that there would simply be an extra space between all the lines. Also, when I use the print method, there are no line breaks at all in the target file.
Can anybody help?
Here is my code:
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com