public void extract(String winmailFilename, String directoryName) throws Exception { HMEFContentsExtractor ext = new HMEFContentsExtractor(new File(winmailFilename)); File dir = new File(directoryName); File rtf = new File(dir, "message.rtf"); if(! dir.exists()) { throw new FileNotFoundException("Output directory " + dir.getName() + " not found"); } System.out.println("Extracting..."); ext.extractMessageBody(rtf); ext.extractAttachments(dir); System.out.println("Extraction completed"); }
public static void main(String[] args) throws Exception { if(args.length < 2) { System.err.println("Use:"); System.err.println(" HMEFContentsExtractor <filename> <output dir>"); System.err.println(""); System.err.println(""); System.err.println("Where <filename> is the winmail.dat file to extract,"); System.err.println(" and <output dir> is where to place the extracted files"); System.exit(2); } HMEFContentsExtractor ext = new HMEFContentsExtractor(new File(args[0])); File dir = new File(args[1]); File rtf = new File(dir, "message.rtf"); if(! dir.exists()) { throw new FileNotFoundException("Output directory " + dir.getName() + " not found"); } System.out.println("Extracting..."); ext.extractMessageBody(rtf); ext.extractAttachments(dir); System.out.println("Extraction completed"); }
ext.extractAttachments(dir); System.out.println("Extraction completed");