JAVA SOUND
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Arghya_Banerjee
Posted On:   Monday, April 21, 2003 05:18 AM

Hi I am worte this programe which will play a Sound File(.wav) from the directory called FileCheck and delete that file from the directory. But it's playing the .wav file but not deleting the file from the directory. Please let me know what could be the reason. If anyone know the answer please modify the program and reply me. Regards Arghya Banerjee import java.io.*; import javax.swing.*; import java.applet.*; public class SoundTest extends Thread { File ff; AudioClip clip; public SoundTest() { start(); } public static void main(String[] args) { SoundTest fileCheck    More>>
			
Hi

I am worte this programe which will play a Sound File(.wav) from the directory called FileCheck and delete that file from the directory.
But it's playing the .wav file but not deleting the file from the directory. Please let me know what could be the reason.

If anyone know the answer please modify the program and reply me.

Regards

Arghya Banerjee



import java.io.*;

import javax.swing.*;

import java.applet.*;



public class SoundTest extends Thread {



File ff;
AudioClip clip;

public SoundTest() {
start();

}
			
public static void main(String[] args) {


SoundTest fileCheck = new SoundTest();




}

			
public void run(){

while(true){
System.out.println("Inside Loop");
fileCheck();


}
}

			
public void fileCheck(){

			
System.out.println("Inside File Check");
File f = new File("c:\FileCheck");

			
try{
String str[] = f.list();
if(str.length > 0) {
System.out.println("Hi");
ff = new File("c:\FileCheck\"+ str[0]);
clip = Applet.newAudioClip(ff.toURL());
clip.play();

			
try{
sleep(2000);
}
catch(Exception e){
}

			

clip.stop();
boolean result = ff.delete();

if(result)
System.out.println("Deleted : ");
else
System.out.println("Not Deleted : ");


}
}
catch(Exception e){
e.printStackTrace();

}

}

}
   <<Less
About | Sitemap | Contact