james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Joseph Krogh <andr...@visena.com>
Subject How to avoid allocating large byte-arrays for large messages
Date Mon, 21 Sep 2015 16:30:25 GMT
Hi all.
 
We're using mime4j to read/parse messages and storing them in a database. For 
large messages we get OutOfMemoryErrors because BasicBodyFactory and 
BasicBinaryBody operate on byte[].
 
I see on this page: https://james.apache.org/mime4j/
that the Message-class is referenced which according to the JavaDoc operate on 
streams which looks like it would fit perfect for us. The problem is that I 
cannot find this class anywhere.
 
We're using the following code to parse an input-stream:
 
val messageBuilder = new DefaultMessageBuilder() val mimeConfig = new 
MimeConfig() mimeConfig.setMaxContentLen(-1) // disable 
mimeConfig.setMaxLineLen(-1) // disable mimeConfig.setMaxHeaderCount(-1) // 
disablemimeConfig.setMaxHeaderLen(-1) // disable  
messageBuilder.setMimeEntityConfig(mimeConfig)val mimeMessage: Message = 
messageBuilder.parseMessage(is) 
 
 
Can anyone please point me to the correct dependencies to be able to use the 
Message-class instead, and hopefully some code-example of how to use it to 
accomplish the same as the code above except with hopefully a lot less 
memory-usage?
 
Thanks.
 
-- Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
andreas@visena.com <mailto:andreas@visena.com>
www.visena.com <https://www.visena.com>
 <https://www.visena.com>



Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
    • Unnamed multipart/related (inline, None, 0 bytes)
View raw message