Search in sources :

Example 1 with EOLConvertingInputStream

use of org.apache.james.mime4j.io.EOLConvertingInputStream in project android_packages_apps_Dialer by LineageOS.

the class MimeMessage method parse.

public void parse(InputStream in) throws IOException, MessagingException, MimeException {
    final MimeStreamParser parser = init();
    parser.parse(new EOLConvertingInputStream(in));
}
Also used : MimeStreamParser(org.apache.james.mime4j.parser.MimeStreamParser) EOLConvertingInputStream(org.apache.james.mime4j.io.EOLConvertingInputStream)

Example 2 with EOLConvertingInputStream

use of org.apache.james.mime4j.io.EOLConvertingInputStream in project k-9 by k9mail.

the class MimePartStreamParser method parse.

public static MimeBodyPart parse(FileFactory fileFactory, InputStream inputStream) throws MessagingException, IOException {
    MimeBodyPart parsedRootPart = new MimeBodyPart();
    MimeConfig parserConfig = new MimeConfig.Builder().setMaxHeaderLen(-1).setMaxLineLen(-1).setMaxHeaderCount(-1).build();
    MimeStreamParser parser = new MimeStreamParser(parserConfig);
    parser.setContentHandler(new PartBuilder(parser, fileFactory, parsedRootPart));
    parser.setRecurse();
    try {
        parser.parse(new EOLConvertingInputStream(inputStream));
    } catch (MimeException e) {
        throw new MessagingException("Failed to parse decrypted content", e);
    }
    return parsedRootPart;
}
Also used : MimeConfig(org.apache.james.mime4j.stream.MimeConfig) MessagingException(com.fsck.k9.mail.MessagingException) MimeStreamParser(org.apache.james.mime4j.parser.MimeStreamParser) MimeException(org.apache.james.mime4j.MimeException) MimeBodyPart(com.fsck.k9.mail.internet.MimeBodyPart) EOLConvertingInputStream(org.apache.james.mime4j.io.EOLConvertingInputStream)

Example 3 with EOLConvertingInputStream

use of org.apache.james.mime4j.io.EOLConvertingInputStream in project k-9 by k9mail.

the class MimeMessage method parse.

private void parse(InputStream in, boolean recurse) throws IOException, MessagingException {
    mHeader.clear();
    mFrom = null;
    mTo = null;
    mCc = null;
    mBcc = null;
    mReplyTo = null;
    xOriginalTo = null;
    deliveredTo = null;
    xEnvelopeTo = null;
    mMessageId = null;
    mReferences = null;
    mInReplyTo = null;
    mSentDate = null;
    mBody = null;
    MimeConfig parserConfig = new MimeConfig.Builder().setMaxHeaderLen(-1).setMaxLineLen(-1).setMaxHeaderCount(-1).build();
    MimeStreamParser parser = new MimeStreamParser(parserConfig);
    parser.setContentHandler(new MimeMessageBuilder(new DefaultBodyFactory()));
    if (recurse) {
        parser.setRecurse();
    }
    try {
        parser.parse(new EOLConvertingInputStream(in));
    } catch (MimeException me) {
        throw new MessagingException(me.getMessage(), me);
    }
}
Also used : DefaultBodyFactory(com.fsck.k9.mail.DefaultBodyFactory) MimeConfig(org.apache.james.mime4j.stream.MimeConfig) MessagingException(com.fsck.k9.mail.MessagingException) MimeStreamParser(org.apache.james.mime4j.parser.MimeStreamParser) MimeException(org.apache.james.mime4j.MimeException) EOLConvertingInputStream(org.apache.james.mime4j.io.EOLConvertingInputStream)

Aggregations

EOLConvertingInputStream (org.apache.james.mime4j.io.EOLConvertingInputStream)3 MimeStreamParser (org.apache.james.mime4j.parser.MimeStreamParser)3 MessagingException (com.fsck.k9.mail.MessagingException)2 MimeException (org.apache.james.mime4j.MimeException)2 MimeConfig (org.apache.james.mime4j.stream.MimeConfig)2 DefaultBodyFactory (com.fsck.k9.mail.DefaultBodyFactory)1 MimeBodyPart (com.fsck.k9.mail.internet.MimeBodyPart)1