0

Possible Duplicate:
Getting A File's Mime Type In Java

have a File, is there a way to deduct its content type like application/xml etc?

Community
  • 1
  • 1
user496949
  • 83,087
  • 147
  • 309
  • 426

2 Answers2

1
new MimetypesFileTypeMap().getContentType(new File("yourFile"));

See Also

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
jmj
  • 237,923
  • 42
  • 401
  • 438
0

Try jMimeMagic and Mime Type Detection Utility

Taken from: How to detect files type

objects
  • 8,637
  • 4
  • 30
  • 38