private void downloadFileWithStream(String fileName) { try { InputStream is = downloadFile(fileName); download(is, MAMUtil.getTempDownloadPath() + fileName); FileUtils.moveFile( new java.io.File(MAMUtil.getTempDownloadPath() + fileName), new java.io.File(MAMUtil.getMusicPath() + fileName)); } catch (Exception e) { MAMUtil.writeLog(e); e.printStackTrace(); } }
public GoogleDriveDownloadTask(ArrayList<String> fileList) { ArrayList<String> fileToDownloadList = new ArrayList<String>(); int fileToDownload = 0; for (String fileName : fileList) { java.io.File song = new java.io.File(MAMUtil.getMusicPath() + fileName + ".mp3"); if (!song.exists()) { fileToDownloadList.add(fileName); fileToDownload++; } } this.fileList = fileToDownloadList; this.totalFileNumber = fileToDownload; }