Currently StorageProvider defines a method to create a Storage object
from an InputStream because an InputStream is what you get from
ContentHandler.

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();
    doc.writeTo(out);
    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..

Markus

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

Reply via email to