Created
April 16, 2016 16:27
-
-
Save prietopa/6d6f15e1c30d5bef4167d1a3a932909a 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
package es.pp.jm.utils; | |
import java.io.FileOutputStream; | |
import java.net.URL; | |
import java.nio.channels.Channels; | |
import java.nio.channels.ReadableByteChannel; | |
public class DownloadVideoFromInternet { | |
// http://stackoverflow.com/questions/921262/how-to-download-and-save-a-file-from-internet-using-java | |
public static void main(String[] args) throws Exception { | |
URL website = new URL("http://mediasitems.cloudapp.net/ProgressiveDownload/24dc633a-4191-4036-ba54-4a0e8e594a89.mp4"); | |
ReadableByteChannel rbc = Channels.newChannel(website.openStream()); | |
FileOutputStream fos = new FileOutputStream("25_BuenasPracticas.mp4"); | |
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