Last active
December 14, 2015 04:18
-
-
Save java-MagicWang/5026989 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void download(String url, String fileURL) { | |
try { | |
URL website = new URL(url); | |
ReadableByteChannel rbc = Channels.newChannel(website.openStream()); | |
FileOutputStream fos = new FileOutputStream(fileURL); | |
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment