Advertisement
horato

This is not shitty

May 17th, 2011
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. private static void copyFile(URL sourceURL, String destFileName) throws IOException
  2. {
  3. File destFile = new File(destFileName);
  4. File destDirectory = destFile.getParentFile();
  5. destDirectory.mkdirs();
  6. InputStream srcStream = sourceURL.openStream();
  7. try{
  8. OutputStream destStream = new FileOutputStream(destFile);
  9. try{
  10. copyStreams(srcStream, destStream);
  11. }finally{
  12. destStream.close();
  13. }
  14. }finally{
  15. srcStream.close();
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement