Java FileOutputStream Write saveToEml(Message mail, File emlFile)

Here you can find the source of saveToEml(Message mail, File emlFile)

Description

save To Eml

License

Open Source License

Declaration

public static void saveToEml(Message mail, File emlFile) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;
import java.io.FileOutputStream;

import java.io.OutputStream;

import javax.mail.Message;

public class Main {
    public static void saveToEml(Message mail, File emlFile) throws Exception {
        OutputStream os = null;/* w w  w  .ja  v a 2 s  . c o m*/
        try {
            os = new FileOutputStream(emlFile);

            mail.writeTo(os);
        } finally {
            if (os != null) {
                os.close();
            }
        }
    }
}

Related

  1. saveTo(String path, InputStream in)
  2. saveToBinaryFile(File dest, byte[] data)
  3. saveToDisc(final InputStream fileInputStream, final String fileUploadPath)
  4. saveToDisk(InputStream is, String filename)
  5. saveToDisk(String contents, String filename)
  6. saveToFile(byte[] data, String filename)
  7. saveToFile(File file, byte[] buffer)
  8. saveToFile(final String file, final byte[] data, final boolean overwrite)
  9. saveToFile(final String text, final File file)