Hello, I am trying to write a simple updater program (in Java). A client would connect to the server, which would hand out any files it needs updated. One example would be updating a Java .class file. I have tried to just copy a class file, to see if that one works. It doesn't. In the following code, please assume BufferedReader is and PrintWriter os have been declared and are open.

while((num = is.read()) != -1){

Um, also, I am not sure what is.read() returns if there are no more characters. I just used -1 because it looked right and I think it is used most often in place of null for integers :cheesy:

Also, one thing to be noted is how the program doesn't work. The two files are very similar, but with some minute differences, like (when viewed through Notepad) a question mark here where a black box is on the other one. Otherwise, the two look the same.

10 Years
Discussion Span
Last Post by ilikerps

Okay, I am sorry for posting in the first place, but I found a solution. Using FileOutputStream and FileInputStream, the individual bytes are copied and the files are the exact same.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.