Created
December 4, 2017 14:32
-
-
Save gabrieldewes/42aec2712cce6c781d9312a737eb235d to your computer and use it in GitHub Desktop.
Baixar um arquivo de um servidor remoto
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
try { | |
URL url = new URL("http://127.0.0.1/scripts/download.php"); | |
ReadableByteChannel readableByteChannel = Channels.newChannel(url.openStream()); | |
FileOutputStream fileOutputStream = new FileOutputStream("resourceFileName.db"); | |
fileOutputStream.getChannel().transferFrom(readableByteChannel, 0, Long.MAX_VALUE); | |
} catch (Exception ex) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment