Class IterateOverMbox


  • public class IterateOverMbox
    extends java.lang.Object
    Simple example of how to use Apache Mime4j Mbox Iterator. We split one mbox file file into individual email messages.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.nio.charset.CharsetEncoder ENCODER  
    • Constructor Summary

      Constructors 
      Constructor Description
      IterateOverMbox()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void main​(java.lang.String[] args)  
      private static java.lang.String messageSummary​(java.io.InputStream messageBytes)
      Parse a message and return a simple String representation of some important fields.
      private static java.lang.String retrieveMBoxFileName​(java.lang.String[] args)  
      private static void saveMessageToFile​(int count, java.nio.CharBuffer buf)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ENCODER

        private static final java.nio.charset.CharsetEncoder ENCODER
    • Constructor Detail

      • IterateOverMbox

        public IterateOverMbox()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • retrieveMBoxFileName

        private static java.lang.String retrieveMBoxFileName​(java.lang.String[] args)
      • saveMessageToFile

        private static void saveMessageToFile​(int count,
                                              java.nio.CharBuffer buf)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • messageSummary

        private static java.lang.String messageSummary​(java.io.InputStream messageBytes)
                                                throws java.io.IOException,
                                                       MimeException
        Parse a message and return a simple String representation of some important fields.
        Parameters:
        messageBytes - the message as InputStream
        Returns:
        String
        Throws:
        java.io.IOException
        MimeException