1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| BufferedReader in = new BufferedReader(new InputStreamReader(requestSocket.getInputStream()));
//un peu de code
//....
File file = null;
FileOutputStream fileOutput = null;
//read the mp3 bloc
if(newSong != "" && newSong != oldSong){
if(fileOutput != null){
fileOutput.flush();
fileOutput.close();
}
file = createFile(newSong+".mp3");
fileOutput = new FileOutputStream(file,true);
}
//lecture et ecriture des données
//interval c'est la taille du block mp3 en lecture
for(int i=0;i<interval;i++){
if(fileOutput != null){
fileOutput.write(in.read());
}
} |
Partager