private static DataSource createDataSource(final MimePart part) throws MessagingException, IOException {
  final DataHandler dataHandler=part.getDataHandler();
  final DataSource dataSource=dataHandler.getDataSource();
  final String contentType=getBaseMimeType(dataSource.getContentType());
  final byte[] content=MimeMessageParser.getContent(dataSource.getInputStream());
  final ByteArrayDataSource result=new ByteArrayDataSource(content,contentType);
  final String dataSourceName=getDataSourceName(part,dataSource);
  result.setName(dataSourceName);
  return result;
}

private static DataSource createDataSource ( final MimePart part ) throws MessagingException , IOException { final DataHandler dataHandler = part . getDataHandler ( ) ; final DataSource dataSource = dataHandler . getDataSource ( ) ; final String contentType = getBaseMimeType ( dataSource . getContentType ( ) ) ; final byte [ ] content = MimeMessageParser . getContent ( dataSource . getInputStream ( ) ) ; final ByteArrayDataSource result = new ByteArrayDataSource ( content , contentType ) ; final String dataSourceName = getDataSourceName ( part , dataSource ) ; result . setName ( dataSourceName ) ; return result ; }
parses the mimepart to create a datasource .
