J'ai utilisé la méthode suivante pour télécharger un fichier mp3 à: http://online1.tingclass.com/lesson/shi0529/43/32.mp3Comment utiliser Java pour télécharger un fichier mp3 en ligne?
Mais j'ai l'erreur suivante:
java.io.FileNotFoundException: http: \ online1.tingclass.com \ leçon \ shi0529 \ 43 \ 32.mp3 (le nom de fichier, nom de répertoire ou la syntaxe d'étiquette de volume est incorrect)
public static void Copy_File(String From_File,String To_File)
{
try
{
FileChannel sourceChannel=new FileInputStream(From_File).getChannel();
FileChannel destinationChannel=new FileOutputStream(To_File).getChannel();
sourceChannel.transferTo(0,sourceChannel.size(),destinationChannel);
// or
// destinationChannel.transferFrom(sourceChannel, 0, sourceChannel.size());
sourceChannel.close();
destinationChannel.close();
}
catch (Exception e) { e.printStackTrace(); }
}
Pourtant, si je le fais à partir d'un navigateur à la main, le fichier est là, je me demande pourquoi il ne fonctionne pas , et quelle est la bonne façon de le faire?
Frank