Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OutputStream outStream = null;
- InputStream is = null;
- HttpURLConnection conn;
- try {
- URL url;
- byte[] buf;
- int byteRead, byteWritten = 0;
- url = new URL(getFinalLocation("https://cdn-1.watchenga.tv/movies/the-cabin-in-the-woods/original_360.mp4"));
- outStream = new BufferedOutputStream(new FileOutputStream("test.mp4"));
- conn = (HttpURLConnection) url.openConnection();
- is = conn.getInputStream();
- buf = new byte[1024];
- while ((byteRead = is.read(buf)) != -1) {
- outStream.write(buf, 0, byteRead);
- byteWritten += byteRead;
- }
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- // is.close();
- // outStream.close();
- }
Add Comment
Please, Sign In to add comment