Created
April 13, 2016 13:51
-
-
Save antoni/a914722b6550bd5e6a7473f163283371 to your computer and use it in GitHub Desktop.
Download file using Java NIO
This file contains 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
URL website = new URL(FILE_URL); | |
ReadableByteChannel rbc = Channels.newChannel(website.openStream()); | |
FileOutputStream fos = new FileOutputStream(TMP_FILE_NAME); | |
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment