download - Java NIO downloaded file is different than web browser -
i trying download .torrent
file url using java nio. downloading file web browser results in proper torrent file can used. downloading in java results in different/corrupted file.
this code using perform download:
url url = new url("http://torcache.net/torrent/e4b5326aa31d1ae0c30e05129193e87aa086f5f8.torrent"); readablebytechannel rbc = channels.newchannel(url.openstream()); fileoutputstream fos = new fileoutputstream("test.torrent"); fos.getchannel().transferfrom(rbc, 0, long.max_value); fos.close();
Comments
Post a Comment