does Java have a way of telling if a drive is a floppy, hard/fixed disk, CD, etc? basing on some classes in JDK1.4, i've learned that Java assumes that a & b ( i'm making this on windows ) are always floppy drives, and the rest would just be another type of drive. it doesn't give any distinction.
so far, the only solution i have come to think of is to add natives which will be responsible for identifying drive types.
I browsed through the java docs rather quickly but cannot find anything. You have mentioned some classes that helps java assume that "a" and "b" are floppu drives - which classes or packages are these.
Post the details and we may be able to dig a little deeper together.
ya, and no one seems to anwer this question in all the forums i've been. so far the only class that i've seen that somehow deals with my question is javax.swing.filechooser.FileSystemView.java. check it out and you'll see... but i read this class in when i still had JDK1.3.1. i'm not sure if some things change in 1.4 but i'm sure there isn't too big a change or none at all. do tell me if there are other classes that are related. thanks!
According to JDK 1.4 docs the following contains the functionality you desire (as you've already figured out and mentioned in your msg):
typically the methods that you need are :
1) boolean isFloppyDrive(File dir) ;
2) boolean isDrive(File dir)
3) String getSystemDisplayName(File f)
the last one according to JDK docs is multipurpose as it returns the information as string.
For example from Windows: the "M:\" directory displays as "CD-ROM (M: ) "
If you need more help then feel free to post here or start a new thread.
I don't know about you but, some of the methods in this particular class ain't working. For the 3 methods that you have mentioned, only 1 works fine - getSystemDisplayName( File f ). and this method doesn't say (C Fixed Drive, or (D CD-ROM drive. it gets the system name instead, e.g (D The Journeys of Jain Farstrider. the other 2 doesn't work. the documentation says that - "default implementation has no way of knowing so always returns false...". besides, if it did work at all, this doesn't answer my question. all 3 methods doesn't answer it. what i wanted was a way of knowing what drive is a floppy, fixed, a CD-ROM or other particular drive/partition. i got stuck in my project because of this since i didn't test it first before i proposed my project. i was so confident that it would work. and it wasn't even close to my project implementation. hahaha.... i made another class instead that assumes this and that and it sucks! but it got me curious though. incorporating C++ or C, natives, would be a solution. can you suggest another?
Hmm...I've not come across any of this but I was gonna suggest you use the JNI to write a little C module to do it. I'm sure it can't be too hard to work out (though whenever anyone says that it ends up being extremely difficult, heh!) and there's probably already some modules written that will do this.
Otherwise, I'd suggest that you use your previously written solution and state that you had many troubles overcomming it and also suggest alternatives. This will often get as many marks as doing exactly what is asked.
Hope that helps.
that's what i said, right? the only solution i can think of is by using natives - JNI - if you call it. i'll have to review a little on my C. i was only up to file-handling until they made us shift to Java. i doubt an all Java solution is there at all...
oK. I'll have to try the methods I posted above to check why it is not giving the intended functionality. Presently hard pressed for time so you may have to wait till week end.
In the meantime I recommend you search/post the forums at java.sun.com - the official homepage of Java.
nobody replies there! everyone's posting and noone replies. hahaha.... if the posts here can be compared to a church on monday, there it's like Mars...
pardon but it should not have been "if the posts here can be compared....", but rather the replies. at least here even if the replies are nowhere close to the answer one wants, and i am not pointing to anyone, you still get one or two...
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL