1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| for(tous_les_flash_de_ma_playlist){
URL url = new URL(url_du_flash_de_ma_playlist)
URLConnection connection = url.openConnection();
File download = new File(nom_du_flash);
if(connection.getContentLength() != download.length()){
try{
InputStream is = connection.getInputStream();
FileOutputStream fos = new FileOutputStream(nom_du_flash);
byte[] buffer = new byte[1024];
int read;
while ((read = is.read(buffer)) > 0)
fos.write(buffer, 0, read);
fos.flush();
fos.close();
is.close();
} catch (Exception e) {}
}
} |
Partager