I am trying to read file headers using java, I want to get file type(image, audio whatever). I have tried many examples but nothing seems to work. I tried preon and no luck, can some one tell me how to read file headers using preon or some other Java apis thanks...
Use mime-util's MagicMimeMimeDetector:
detector.getMimeTypes(file)