Hey Everybody,
I'm currently working on a program for random play of my MediaPlayList (Simpsons, Futurama, Music etc.). Therefore i wrote a subroutine, which is finding and filtering
all media files in a given folder:
This routine is taking every file which isn't .jpg or .cmd at the moment. Works, everything fine. (Perhaps you have an idea of how to make thisroutine smaller and perhaps nonrecursive oO
?)
Now, i want to filter things explicitly by their filetype, and I don't want to do it in the manner done here (with if(path not contains bla)) but with a method of file like f.isMediaFile().
I therefore wrote a MediaFile Class:
and changed the type of my get the files routine to
but now, I get a classcast error (Exception in
thread "main" java.lang.ClassCastException: [Ljava.io.File; cannot be cast to [LMediaFile;) on:
direc is of type MediaFile, but will return a File Array. Where is my error in this concept, how can I circumvent this? Everthing I want is the easier checking if a File is a Media-File or not.
Please help and thanks in advance for your help
Regards,
CaZe