DataHandler class belongs to javax.activation package and it is useful when you have data in different sources and formats because DataHandler provides consistent interface for different formats.

Lets see how to create an object of DataHandler.
Java Code:
String filename = "abc.xml";
File repositoryItemFile = new File(filename);
DataHandler repositoryItem = 
  new DataHandler(new FileDataSource(repositoryItemFile));