Hi Andy,

thx for the information. It whould be cool if you can open a jira issue
next time, to help us to find such problems.

I will do it now for the stuff you posted.

Thx
Norman


Andrew C. Oliver schrieb:
> Mime4j has general demonstrable performance problems:
> http://buni.org/bugzilla/show_bug.cgi?id=137
> http://blog.buni.org/blog/mbarker/Meldware/2007/01/27/Look-out-Its-behind-you
>
>
> I'd suggest a general code review for the "byte at a time + buffered
> input stream" anti-pattern
> and general refactoring to do things in blocks where possible.
>
> -Andy
>
> Niklas Therning wrote:
>> Norman Maurer wrote:
>>  
>>> Hi all,
>>>
>>> i just looked at the mime4j javadoc and wonder what whould be the best
>>> solution to get all attachment names of a given inputstream.. I thought
>>> this will maybe give me a better performance then using javamail for
>>> this... Im wrong ?
>>>       
>> Mime4j should be faster for this kind of things. See the attachment for
>> an example of how to get the filename parameter from the
>> Content-Disposition fields using Mime4j. I think you are looking for
>> something like this, right?
>>  
>>> The other thing i noticed is that mime4j has no "altering" support.
>>> Anything planned here ?
>>>       
>> Nope, nothing planned at the moment. But if you have any ideas of how
>> Mime4j could be improved, please share them.
>>
>>  
>> ------------------------------------------------------------------------
>>
>> import java.io.FileInputStream;
>> import java.io.IOException;
>> import java.util.regex.Matcher;
>> import java.util.regex.Pattern;
>>
>> import org.mime4j.AbstractContentHandler;
>> import org.mime4j.EOLConvertingInputStream;
>> import org.mime4j.MimeStreamParser;
>> import org.mime4j.field.Field;
>> import org.mime4j.field.UnstructuredField;
>>
>>
>> public class Main {
>>     private static final Pattern P =
>> Pattern.compile(".*filename=(\".*?\"|[^\\s]*).*");
>>
>>     public static void main(String[] args) throws IOException {
>>         MyHandler handler = new MyHandler();
>>         MimeStreamParser parser = new MimeStreamParser();
>>         parser.setContentHandler(handler);
>>         parser.parse(new EOLConvertingInputStream(new
>> FileInputStream(args[0])));
>>     }
>>
>>     public static class MyHandler extends AbstractContentHandler {
>>         @Override
>>         public void field(String fieldData) {
>>             if
>> (fieldData.toLowerCase().startsWith("content-disposition:")) {
>>                 UnstructuredField field = (UnstructuredField)
>> Field.parse(fieldData);
>>                 Matcher m = P.matcher(field.getValue());
>>                 if (m.matches()) {
>>                     String filename = m.group(1);
>>                     System.out.println(filename);
>>                 }
>>             }
>>         }
>>     }
>> }
>>
>>  
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> !EXCUBATOR:1,45d8cb7539413506015501!


-- 
Mit freundlichen Grüßen 

i.A. Norman Maurer 
Systemadministrator

ByteAction GmbH
Auf der Beune 83-85
64839 Münster

Phone:   +49 (0) 60 71 92 16 - 21
Fax:       +49 (0) 60 71 92 16 - 20
E-mail:    [EMAIL PROTECTED]
Internet: www.byteaction.de
AG Darmstadt, HRB 33271
Ust-Id: DE206997247
GF: Thomas Volkert
------------------------------------------------------ 
Diese E-Mail enthält vertrauliche Informationen und ist nur für den in der 
E-Mail genannten Adressaten bestimmt. Für den Fall, dass der Empfänger dieser 
E-Mail nicht der in der E-Mail benannte Adressat ist, weisen wir darauf hin, 
dass das Lesen, Kopieren, die Wiedergabe, Verbreitung, Vervielfältigung, 
Bekanntmachung, Veränderung, Verteilung und/oder Veröffentlichung der E-Mail 
strengstens untersagt ist. Bitte verständigen Sie den Absender dieser E-Mail 
unter folgender Rufnummer +49 (0) 6071 / 9216-0, falls Sie irrtümlich diese 
E-Mail erhalten haben und löschen Sie diese E-Mail. Der Inhalt dieser E-Mail 
ist nur rechtsverbindlich, wenn er von unserer Seite schriftlich durch Brief 
oder Telefax bestätigt wird. Die Versendung von E-Mails an uns hat keine 
fristwahrende Wirkung. 

This e-mail contains information which is privileged and is intended only for 
the Addressee named in the e-mail. In case that the recipient of this e-mail is 
not the named addressee, we would like to inform you that it is strictly 
prohibited to read, to reproduce, to disseminate, to copy, to disclose, to 
modify, to distribute and/or to publish this e-mail. If you have received this 
e-mail in error, please call the sender under following telephone number +49 
(0) 6071 / 9216-0 and delete this e-mail. The content of this e-mail is not 
legally binding unless confirmed by letter or telefax. E-mails which are sent 
to us do not constitute compliance with any time limits or deadlines.
------------------------------------------------------ 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to