read url in binary mode in java

Posted by Andrew Zawok on Stack Overflow See other posts from Stack Overflow or by Andrew Zawok
Published on 2010-06-06T01:10:20Z Indexed on 2010/06/06 1:12 UTC
Read the original article Hit count: 428

Filed under:
|
|
|
|

In java I need to read a binary file from a site and write it to a disk file. This example http://java.sun.com/docs/books/tutorial/networking/urls/readingURL.html could read webpages succesfully, but when I try to read a binary file from my localhost server and write it to a disk file the contents change, corrupting the binary file. Using fc I see that 0x90 is changed to 0x3F and other changes. How do I acess the binary files (read url and write to file) without java or anything else changing ANY characters, like doing any newline conversions or character conversions or anything else, simply reading input url and writing it out as a file.

© Stack Overflow or respective owner

Related posts about java

Related posts about file