Class MboxIterator
java.lang.Object
org.apache.james.mime4j.mboxiterator.MboxIterator
- All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<CharBufferWrapper>
Class that provides an iterator over email messages inside an mbox file. An mbox file is a sequence of email messages separated by From_ lines.
Description ot the file format:
- http://tools.ietf.org/html/rfc4155
- http://qmail.org/man/man5/mbox.html
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprivate class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBufferprivate final CharsetDecoderprivate booleanFlag to signal end of input toCharsetDecoder.decode(java.nio.ByteBuffer).private intprivate intprivate booleanprivate Matcherprivate final intprivate final Pathprivate final CharBufferprivate final Pattern -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMboxIterator(Path mbox, Charset charset, String regexpPattern, int regexpFlags, int MAX_MESSAGE_SIZE) -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbufferDetailsToString(Buffer buffer) Utility method to log important details about buffers.voidclose()private voidstatic MboxIterator.Builderstatic MboxIterator.Builderstatic MboxIterator.Builderprotected voidinitialize the Mailbox iteratoriterator()private voidsaveFindPositions(Matcher lineMatcher) private voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
mboxCharBuffer
-
fromLineMatcher
-
fromLineFound
private boolean fromLineFound -
byteBuffer
-
DECODER
-
endOfInputFlag
private boolean endOfInputFlagFlag to signal end of input toCharsetDecoder.decode(java.nio.ByteBuffer). -
maxMessageSize
private final int maxMessageSize -
MESSAGE_START
-
findStart
private int findStart -
findEnd
private int findEnd -
mbox
-
-
Constructor Details
-
MboxIterator
private MboxIterator(Path mbox, Charset charset, String regexpPattern, int regexpFlags, int MAX_MESSAGE_SIZE) throws FileNotFoundException, IOException, CharConversionException
-
-
Method Details
-
initMboxIterator
initialize the Mailbox iterator- Throws:
IOExceptionCharConversionException
-
decodeNextCharBuffer
- Throws:
CharConversionException
-
updateEndOfInputFlag
private void updateEndOfInputFlag() -
saveFindPositions
-
iterator
- Specified by:
iteratorin interfaceIterable<CharBufferWrapper>
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
fromFile
-
fromFile
-
fromFile
-
bufferDetailsToString
-