Class MailSaver

java.lang.Object
java.util.Observable
com.nilhcem.fakesmtp.server.MailSaver

public final class MailSaver extends Observable
Saves emails and notifies components so they can refresh their views with new data.
Since:
1.0
Author:
Nilhcem
  • Constructor Details

    • MailSaver

      public MailSaver()
  • Method Details

    • saveEmailAndNotify

      public void saveEmailAndNotify(String from, String to, InputStream data)
      Saves incoming email in file system and notifies observers.
      Parameters:
      from - the user who send the email.
      to - the recipient of the email.
      data - an InputStream object containing the email.
      See Also:
      • to see which observers will be notified
    • deleteEmails

      public void deleteEmails()
      Deletes all received emails from file system.
    • getLock

      public Object getLock()
      Returns a lock object.

      This lock will be used to make the application thread-safe, and avoid receiving and deleting emails in the same time.

      Returns:
      a lock object (which is actually the current instance of the MailSaver object).