Class IMAPImportHelper

java.lang.Object
org.imixs.workflow.importer.mail.IMAPImportHelper

public class IMAPImportHelper extends Object
A helper bean with static methods
Version:
1.0
Author:
rsoika
  • Constructor Details

    • IMAPImportHelper

      public IMAPImportHelper()
  • Method Details

    • isMediaTypeOctet

      public static boolean isMediaTypeOctet(String contentType, String filename)
      This method returns true if the mediaType of a file attachment is

      "application/octet-stream"

      In some cases we have a situation where the contentType is "application/octet" which is not a valid content type. Also in this case we return true!

      Parameters:
      contentType -
      Returns:
    • readAllBytes

      public static byte[] readAllBytes(InputStream inputStream) throws IOException
      Read inputstream into a byte array.
      Parameters:
      inputStream -
      Returns:
      Throws:
      IOException
    • fixContentType

      public static String fixContentType(String contentType, String fileName, boolean debug)
      Fixes malformed MIME content types in file attachments. Some email clients or servers generate incorrect MIME types with invalid characters (dots, spaces) around the slash separator. This method cleans up these common formatting errors to ensure proper content type recognition. Common fixes applied: - application/.pdf → application/pdf - text /html → text/html - image. /jpeg → image/jpeg - application . /pdf → application/pdf The method also converts 'application/octet-stream' into 'application/pdf' if the file is a pdf file. prefixes will be striped automatically.
      Parameters:
      snapshot - the ItemCollection containing FileData objects to fix