private MboxIterator(final File mbox, final Charset charset, final String regexpPattern, final int regexpFlags, final int MAX_MESSAGE_SIZE) throws FileNotFoundException, IOException, CharConversionException { //TODO: do better exception handling - try to process some of them maybe? this.maxMessageSize = MAX_MESSAGE_SIZE; this.MESSAGE_START = Pattern.compile(regexpPattern, regexpFlags); this.DECODER = charset.newDecoder(); this.mboxCharBuffer = CharBuffer.allocate(MAX_MESSAGE_SIZE); this.mbox = mbox; this.theFile = new FileInputStream(mbox); this.byteBuffer = theFile.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, theFile.getChannel().size()); initMboxIterator(); }