How do I know the type of media inserted in a DVD / CD drive? (Java)

When I insert a DVD or CD, I want to programmatically find out what type of media (DVD or CD).

+4
source share
1 answer

IMHO it is impossible to solve this problem with pure Java. The only thing you can do is through FileSystemView and determine if a particular file is a cd / dvd but does not contain a CD or DVD. Although you can get a reasonable assumption by getting the total used space.

For a working solution, you will need at least JNI code for the three "large" OS. I do not know any project that has done this. For Linux, there are only platform-specific libraries / utilities that use the usual cdrw / dvdrw tools in the background.

+2
source

Source: https://habr.com/ru/post/1277490/


All Articles