congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
EmlExtractor
Code IndexAdd Tabnine to your IDE (free)

How to use
EmlExtractor
in
org.codelibs.fess.crawler.extractor.impl

Best Java code snippets using org.codelibs.fess.crawler.extractor.impl.EmlExtractor (Showing top 5 results out of 315)

origin: org.codelibs.fess/fess-crawler

  final Session mailSession = Session.getDefaultInstance(props, null);
  final MimeMessage message = new MimeMessage(mailSession, in);
  final String content = getBodyText(message);
  final ExtractData data = new ExtractData(content != null ? content : StringUtil.EMPTY);
  final Enumeration<Header> headers = message.getAllHeaders();
  putValue(data, "Content-ID", message.getContentID());
  putValue(data, "Content-Language", message.getContentLanguage());
  putValue(data, "Content-MD5", message.getContentMD5());
  putValue(data, "Description", message.getDescription());
  putValue(data, "Disposition", message.getDisposition());
  putValue(data, "Encoding", message.getEncoding());
  putValue(data, "File-Name", message.getFileName());
  putValue(data, "From", message.getFrom());
  putValue(data, "Line-Count", message.getLineCount());
  putValue(data, "Message-ID", message.getMessageID());
  putValue(data, "Message-Number", message.getMessageNumber());
  putValue(data, "Received-Date", getReceivedDate(message));
  putValue(data, "Reply-To", message.getReplyTo());
  putValue(data, "Sender", message.getSender());
  putValue(data, "Sent-Date", message.getSentDate());
  putValue(data, "Size", message.getSize());
  putValue(data, "Subject", message.getSubject());
  putValue(data, "Receipients", message.getAllRecipients());
  putValue(data, "To", message.getRecipients(Message.RecipientType.TO));
  putValue(data, "Cc", message.getRecipients(Message.RecipientType.CC));
  putValue(data, "Bcc", message.getRecipients(Message.RecipientType.BCC));
  return data;
} catch (final MessagingException e) {
origin: org.codelibs.fess/fess-crawler

protected static Date getReceivedDate(final javax.mail.Message message) throws MessagingException {
  final Date today = new Date();
  final String[] received = message.getHeader("received");
  if (received != null) {
    for (final String v : received) {
      String dateStr = null;
      try {
        dateStr = getDateString(v);
        final Date receivedDate =
          new MailDateFormat().parse(dateStr);
        if (!receivedDate.after(today)) {
          return receivedDate;
        }
      } catch (final ParseException e) {
        // ignore
      }
    }
  }
  return null;
}
origin: org.codelibs.fess/fess-crawler

protected void appendAttachment(final StringBuilder buf, final BodyPart bodyPart) {
  final MimeTypeHelper mimeTypeHelper = getMimeTypeHelper();
  final ExtractorFactory extractorFactory = getExtractorFactory();
  try {
    final String filename = getDecodeText(bodyPart.getFileName());
    final String mimeType = mimeTypeHelper.getContentType(null, filename);
    if (mimeType != null) {
      final Extractor extractor = extractorFactory.getExtractor(mimeType);
      if (extractor != null) {
        try (final InputStream in = bodyPart.getInputStream()) {
          final Map<String, String> map = new HashMap<>();
          map.put(TikaMetadataKeys.RESOURCE_NAME_KEY, filename);
          final String content = extractor.getText(in, map).getContent();
          buf.append(content).append(' ');
        } catch (final Exception e) {
          if (logger.isDebugEnabled()) {
            logger.debug("Exception in an internal extractor.", e);
          }
        }
      }
    }
  } catch (MessagingException e) {
    if (logger.isDebugEnabled()) {
      logger.debug("Exception in parsing BodyPart.", e);
    }
  }
}
origin: org.codelibs.fess/fess-crawler

if (value instanceof String) {
  if ("Subject".equals(key)) {
    data.putValue(key, getDecodeText(value.toString()));
  } else {
    data.putValue(key, value.toString());
  for (int i = 0; i < size; i++) {
    final Address address = ((Address[]) value)[i];
    values[i] = getDecodeText(address.toString());
origin: org.codelibs.fess/fess-crawler

final BodyPart bodyPart = multipart.getBodyPart(i);
if (Part.ATTACHMENT.equalsIgnoreCase(bodyPart.getDisposition())) {
  appendAttachment(buf, bodyPart);
} else if (bodyPart.isMimeType("text/plain")) {
  buf.append(bodyPart.getContent().toString()).append(' ');
org.codelibs.fess.crawler.extractor.implEmlExtractor

Javadoc

Gets a text from .eml file.

Most used methods

  • appendAttachment
  • getBodyText
  • getDateString
  • getDecodeText
  • getExtractorFactory
  • getMimeTypeHelper
  • getReceivedDate
  • putValue

Popular in Java

  • Making http post requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • getSharedPreferences (Context)
  • Kernel (java.awt.image)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now