What is a FileDataSource?
Created May 4, 2012
John Zukowski A FileDataSource is part of the JavaBeans Activation Framework, package javax.activation. It represents a DataSource associated with a file, that relies on a FileTypeMap to associate mime types with file extensions. They can be used to send file attachments:
MimeBodyPart messageBodyPart = new MimeBodyPart(); DataSource source = new FileDataSource(fileAttachment); messageBodyPart.setDataHandler( new DataHandler(source)); messageBodyPart.setFileName( filenameString);
The other type of predefined DataSource in the Activation Framework is the URLDataSource.