james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Wiederkehr" <markus.wiederk...@gmail.com>
Subject [mime4j] OutputStream support for StorageProvider?
Date Wed, 03 Dec 2008 19:59:47 GMT
Currently StorageProvider defines a method to create a Storage object
from an InputStream because an InputStream is what you get from

But many libraries provide some kind of mechanism to write a document
to an OutputStream. iText's PdfWriter would be one example. Writing an
XML document with LSSerializer/LSWriter would be another. Even Mime4j
has a writeTo() method declared in Body.

So what if I wanted to create an e-mail attachment from one of these
documents? Currently I'd have to write to a file or a
ByteArrayOutputStream and then create a Storage by reading back the
content. Clearly inefficient..

So I propose to add OutputStream support to StorageProvider. Here's
what it could look like:

    SomeDocument doc = ...;
    StorageProvider sp = DefaultStorageProvider.getInstance();
    StorageOutputStream out = sp.createStorageOutputStream();
    Storage storage = out.toStorage();

Then I would add methods to BodyFactory to create text or binary
bodies directly from a Storage object..

I could implement this on the weekend..


To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org

View raw message