I have a full file path and would like to determine the MediaType (Google's Guava 19.0) it corresponds to. I thought there would be a built in function in MediaType to accomplish this but I don't think so after experimenting and reading the MediaType API.
I know I can accomplish this by writing a giant switch to return a MediaType based on the file extension but I'd rather not do that if I don't have to.
Is there an easy way to accomplish this or is writing a switch my only option? Thanks - Much Appreciated!
Aucun commentaire:
Enregistrer un commentaire